Hi @otip
Or this version, which does the filtering server side so will be significantly faster.
get-adcomputer -ldapfilter '(managedby=*)' -properties name, managedby | select-object name, managedby
Gary.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello community,
I'm trying to get the least of computer objects from my AD where there is a value in the managed by field (not the ones with empty value)
I tried different approaches such as :
Get-ADComputer -filter 'managedby -eq "*"' -properties * | select-object name, managedby
and
get-adcomputer -filter * -properties Name, managedBy | where {$_.managedby -like '*'} | select-object name, managedby
=> this gives me all computers object even with manage by empty. -notlike * give nothing.
I tried different ways with -contains -like -notlike -ne etc but couldn't make it work.
Any help would be appreciated.
Thank you
Hi @otip
Or this version, which does the filtering server side so will be significantly faster.
get-adcomputer -ldapfilter '(managedby=*)' -properties name, managedby | select-object name, managedby
Gary.
Hi @otip ,
The following worked for me when I tried:
Get-ADComputer -Filter * -Properties name, managedBy | Where {$_.managedby -ne $null} | Select-Object name, managedby
----------
If the reply was helpful please don't forget to upvote
and/or accept as answer
, thank you!
Best regards,
Leon