$VerbosePreference = 'continue' get-adcomputer -Filter 'Name -like "te-prd-app-*"' | ForEach-Object { Write-Verbose $PSItem.name Invoke-Command -ComputerName $psitem.DnsHostName -ScriptBlock { hostname; $VerbosePreference = 'continue' $sites = "antwerp","donges","feyzin","grandpuits","leuna","normandie","portarthur" foreach($site in $sites){ Write-Verbose $site if((Get-ACl C:\roserapps\$site).Access | Where-Object {$_.IdentityReference -eq "ROSER-TOTAL\NFZ_$site"}){ (Get-ACl C:\roserapps\$site).Access | Where-Object {$_.IdentityReference -eq "ROSER-TOTAL\NFZ_$site"}} else{ write-error "not there"} } } }