Skip to content

Instantly share code, notes, and snippets.

@panekj
Created January 15, 2020 13:29
Show Gist options
  • Save panekj/e6d42cc4e5b21cba5dfd8c1012595fc2 to your computer and use it in GitHub Desktop.
Save panekj/e6d42cc4e5b21cba5dfd8c1012595fc2 to your computer and use it in GitHub Desktop.
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