This repository has been archived on 2020-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
control-ad/scripts/users/unlock-account.ps1

32 lines
551 B
PowerShell

# load ActiveDirectory module
Try
{
Import-Module ActiveDirectory -ErrorAction Stop
}
Catch
{
Write-Warning $_
Break
}
function Unlock-Account
{
$username = Read-Host 'Please enter a user name'
Try
{
Unlock-ADAccount -Identity $username -ErrorAction Stop
Write-Host
Write-Host $username ' unlocked' -backgroundcolor green
Write-Host
}
Catch
{
Write-Warning $_
Read-Host 'Press a key to quit'
Break
}
Read-Host 'Press a key to quit'
}
Unlock-Account