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.
Show more

Installation Options

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

Install-Script -Name Set-ADAccountStatusByOu

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy 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

Owners

Copyright

(c)2018 Chris Carter

Package Details

Author(s)

  • Chris Carter

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

FileList

Version History

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