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.
2017-07-14 23:58:11 +02:00
|
|
|
# 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
|
2017-07-15 12:18:07 +02:00
|
|
|
Write-Host
|
2017-07-14 23:58:11 +02:00
|
|
|
Write-Host $username ' unlocked' -backgroundcolor green
|
2017-07-15 12:18:07 +02:00
|
|
|
Write-Host
|
2017-07-14 23:58:11 +02:00
|
|
|
}
|
|
|
|
Catch
|
|
|
|
{
|
|
|
|
Write-Warning $_
|
|
|
|
Read-Host 'Press a key to quit'
|
|
|
|
Break
|
|
|
|
}
|
|
|
|
Read-Host 'Press a key to quit'
|
|
|
|
}
|
|
|
|
|
|
|
|
Unlock-Account
|