Currently trying to use the following to pull a list of servers that are not disabled.
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objsearcher.Filter = "(&(OperatingSystem=Window*Server*)(Enabled -eq $true))"
My issue is that this is not a valid search filter.
I've done alot of searching, and cannot find a way to filter for whether a device is enabled or disabled, like I'm attempting to above.
I'm aware that I should be able to do it via:
Get-ADComputer -Filter 'Enabled -eq $true'
But was hoping to avoid this.