Slight modification to your filter script block on the Where-Object. You are looking to compare a single value ($_.name) to ensure it is not in the array of excluded servers
Get-ADGroupmember -Identity Servers |
Where-Object{$_.name -notin $excludedservers} |
Select-Object...
PowerShell has a habit of unwrapping an array if there is one or no entries in the array. You can force the datatype of a variable. I would suggest you make the following change:
[array] $printJobs = Get-WmiObject Win32_PrintJob -ComputerName gdceps02w12v |
Where-Object...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.