PowerShell find disabled users with manager

%3CLINGO-SUB%20id%3D%22lingo-sub-2634208%22%20slang%3D%22en-US%22%3EPowerShell%20find%20disabled%20users%20with%20manager%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2634208%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20find%20all%20disabled%20users%20that%20have%20a%20value%20populated%20for%20the%20manager%20attribute.%20Below%20is%20my%20code%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(get-adforest).domains%20%7C%20ForEach-Object%20%7Bget-aduser%20-ldapfilter%20%22(%26amp%3B(manager%3D*)(%26amp%3B(Disabled%3DTrue)))%22%20-Properties%20givenname%2Csurname%2Cuserprincipalname%2Cemailaddress%20-Server%20%24_%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20is%20appreciated%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent Contributor

Hello 

I am trying to find all disabled users that have a value populated for the manager attribute. Below is my code

 

(get-adforest).domains | ForEach-Object {get-aduser -ldapfilter "(&(manager=*)(&(Disabled=True)))" -Properties givenname,surname,userprincipalname,emailaddress -Server $_}

 

Any help is appreciated 

0 Replies
www.000webhost.com