-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeny-CitrixTimeout.ps1
More file actions
24 lines (23 loc) · 1 KB
/
Deny-CitrixTimeout.ps1
File metadata and controls
24 lines (23 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function Deny-CitrixTimeout {
# Change timer by setting it as a parameter
# Deny-CitrixTimeout -TimerInSeconds 600
# Will send key stroke every 10 minutes
# Mcurry 02/04/2020
param(
[int]$TimerInSeconds = 480
)
[System.Object[]]$processes = Get-Process | Where-Object { $_.ProcessName -match "wfica32" }
if ($processes.count -ge 1) { $process = $processes[0] }
if ($process -is [System.Diagnostics.Process]) {
for (; ; ) {
[void] [System.Reflection.Assembly]::LoadWithPartialName("'Microsoft.VisualBasic")
[Microsoft.VisualBasic.Interaction]::AppActivate($process.Id)
Start-Sleep -seconds 1
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("{SCROLLLOCK}")
Start-Sleep -Milliseconds 350
[System.Windows.Forms.SendKeys]::SendWait("{SCROLLLOCK}")
Start-Sleep -seconds $TimerInSeconds
}
}
}