Skip to content

Instantly share code, notes, and snippets.

@alainassaf

alainassaf/drain-xaserverb.ps1 Secret

Last active Mar 6, 2017
Embed
What would you like to do?
drain-xaserver.ps1 gist 2
# Get the assigned Logon Mode
$xaLogonMode = $isServer.LogOnMode.ToString()
if ($xaLogonMode -eq "ProhibitNewLogOnsUntilRestart") {
Write-Verbose "Server set to ProhibitNewLogOnsUntilRestart"
$canDrain = $true
} elseif ($xaLogonMode -eq "ProhibitNewLogOns") {
Write-Verbose "Server set to ProhibitNewLogOns"
$canDrain = $true
} elseif ($xaLogonMode -eq "ProhibitLogOns") {
Write-Verbose "Server set to ProhibitLogOns"
$canDrain = $true
} else {
Write-Verbose "Server set to AllowLogOns"
$canDrain = $false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment