Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Search AD account for entire domain except on OU

$
0
0

Hi everyone,

I would like to use PS to search for all disabled accounts in the domain except for one OU; how can I modify below for this? 

Search-ADAccount –AccountDisabled –UsersOnly –SearchBase “DC=abc,DC=ca”

I would like to exclude the built-in Users OU.

Also, I would like to modify the below only for disabled user accounts; how can I accomplish that?

Set-ADOrganizationalUnit-ProtectedFromAccidentalDeletion$False

Thanks so much in advance.



Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>