Looking to see if anyone has a script for this...

%3CLINGO-SUB%20id%3D%22lingo-sub-1219639%22%20slang%3D%22en-US%22%3ELooking%20to%20see%20if%20anyone%20has%20a%20script%20for%20this...%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1219639%22%20slang%3D%22en-US%22%3E%3CP%3EI%20need%20a%20script%20that%20will%20do%20the%20following%3A%3C%2FP%3E%3CP%3EQuery%26nbsp%3Ball%20domain%20controllers%20for%20the%20LastLogon%20attribute%20(not%20lastlogontimestamp)%20of%20users%20within%20a%20specific%20OU%20recursively%20and%20get%20any%20user%20accounts%20with%20lastlogon%20time%20greater%20than%2060%20days%20based%20on%20the%20most%20recent%20lastlogon%20between%20all%20the%20domain%20controllers%20as%20lastlogon%20isn't%20synced.%20Then%20disable%20the%20accounts%20past%2060%20days%20and%20move%20to%20a%20specific%26nbsp%3BOU.%20Any%20help%20would%20be%20greatly%20appreciated!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1219639%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Regular Visitor

I need a script that will do the following:

Query all domain controllers for the LastLogon attribute (not lastlogontimestamp) of users within a specific OU recursively and get any user accounts with lastlogon time greater than 60 days based on the most recent lastlogon between all the domain controllers as lastlogon isn't synced. Then disable the accounts past 60 days and move to a specific OU. Any help would be greatly appreciated!

0 Replies