Set-ADAccountStatusByOu

1.0

Set-ADAccountStatusByOu sets the status of accounts (enabled or disabled) by an entire Organizational Unit. You may specify the OU by name or distinguished name. Enabling or disabling is handled by the Enable or Disable switch parameters, with Disable being the default. The SearchScope parameter is for controlling whether child ojbects of the OU are also affected.

In
Set-ADAccountStatusByOu sets the status of accounts (enabled or disabled) by an entire Organizational Unit. You may specify the OU by name or distinguished name. Enabling or disabling is handled by the Enable or Disable switch parameters, with Disable being the default. The SearchScope parameter is for controlling whether child ojbects of the OU are also affected.

In the event that there are multiple OUs in the domain named the same, a menu is given showing all the distinguished names found, and the option to use all or a specific OU to set user statuses.

This script is best used to run as a Scheduled Task to automatically disable users that are put into specifice OUs, like one for ex-employees. If used in this way, specify the Force parameter. This will stop any user input being requested and default to a choice of All.

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Script -Name Set-ADAccountStatusByOu

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deloy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Author(s)

Chris Carter

Copyright

(c)2018 Chris Carter

Owners

Tags

ActiveDirectory Accounts Disable Enable OU

Functions

Get-Dn Select-Dn Get-Choice Disable-User Enable-User Set-AllAccounts

Dependencies

This script has no dependencies.

Release Notes

Initial Release

Version History

Version Downloads Last updated
1.0 (current version) 72 12/6/2018