I have 2 scripts working, when I start them manually.
Moving mouse cursor out of Screen:
[system.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | out-null
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point(1999,100)
If there is a chrome browser open with title HUD, put it to kiosk mode:
[void] [System.Reflection.Assembly]::LoadWithPartialName("'Microsoft.VisualBasic")
[Microsoft.VisualBasic.Interaction]::AppActivate("Hud - Google Chrome")
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("{F11}")
If I put them in a Scheduled Task on Windows 7 they don't work.
They work if I start a batch file calling the script file
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noninteractive -command "&C:\Users\Miniuser\Documents\chromeHUD.ps1"
But not if I start the batch file in a Scheduled Task.
It seems in a Scheduled Task I can't acces my UI elements.
Any ideas?