I just ordered a VPS, running Windows Server. The only thing that this server needs to do is run a Powershell Script, which has an infinite loop (while($true)
) with some code in it.
In general, if I connect to the VPS via Remote Desktop, everything is working fine, it runs and runs and runs. But whenever I quit Remote Desktop, the Powershell Script is paused and doesn't continue until I connect again.
Is there any way to make the script "permanent", so it doesn't halt when I quit the Remote Desktop session?
This is the Powershell-Script:
while($true)
{
Start-Sleep 2
start chrome.exe
Start-Sleep 2
Invoke-Item C:\Users\me\index.html
Start-Sleep 2
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
Start-Sleep 1000
[System.Windows.Forms.SendKeys]::SendWait("%{F4}")
Start-Sleep 2
[System.Windows.Forms.SendKeys]::SendWait("%{F4}")
}
By the way, I start the script from Powershell ISE, not directly execute the script, because then it doesn't know the context SendKeys somehow, but I think that shouldn't change anything, does it?