<# Unlock DRA User #>


Function Unlock-User ($User,$Server)
    {
        $Users = $User.split(",")
        $Count = $Users.count
        $i = 1
        ForEach ($User in $Users)
            {
                $Percent = ($i/$count) * 100
                Show-ProgressBar -Activity "Unlocking $User" -PercentComplete $Percent
                $test = get-ADUser $User -Properties LockedOut
                $test = $test.LockedOut
                $U = Get-ADUser $User
                $User = $U.Name
        
                If ($Server -eq $null -or $Server -eq "") {$Server = "lackland.dra.us.af.mil"} #Default DRA Server
                If ($test -eq "True")
                    {
                        Unlock-DRAUser -DRARestServer $Server -DRARestPort 8755 -DRAHostServer $Server -DRAHostPort 11192 -Domain "AREA52.afnoapps.usaf.mil" -Identifier $User
                        Start-Pause "$User has been unlocked"
                    }
                Else
                    {
                        Start-Pause "$User is not locked out"
                    }
                $i++
            }
    }