Created
January 15, 2020 13:29
-
-
Save panekj/e6d42cc4e5b21cba5dfd8c1012595fc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asnp Citrix* | |
while($true){ ` | |
Get-BrokerSession -SessionState Disconnected -AdminAddress hostname | ForEach-Object -Process { ` | |
$time = ( ( Get-Date ) - ( $_.SessionStateChangeTime ) ).Hours ; if ( $time -gt 6 -and $_.UserName -ne "domain\user") { ` | |
$_ | Stop-BrokerSession ; $_.UserName | Out-File -FilePath "C:\Windows\temp\licence.log" -Append ` | |
} ` | |
} ; Start-Sleep -Seconds 1800 ` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment