powershell get-aduser where manager -eq disabled -
I am trying to find all the ED users where the user is disabled in the manager field
below Given has not worked, has tried many ways, although it does not understand
Get-ADUser -SearchBase "XXX" -filter {enabled -q $ true} - Properties * | Where {Get-aduser -Filter {reputable name-EC $ _ manager- and enabled-a $$ incorrect}}
I have no ads, which are easily available manager attribute, so the script has not been tested. Anyway, to create two collections with a simpler way Get-ADUser , fill one with all disabled accounts and one enabled ones. Loop through competent accounts and check whether the managers are found out from the inefficients. To make things fast, store the disabled code in the form of a hash table with a group-object and use the hashtable include the cookie ( ) Method like this, $ disabled = Get-ADUser -filter {enabled- $ $ true} | Group-object `ASHST -Estestation-Property Name $ users = gate-adder-filter (active -EAk $ real) Forex ($ user in $ user) {if ($ $ disabled.ContainsKey ($ user.Manager)) {# User manager is an disabled account}}
Comments
Post a Comment