Question
Run a powershell script in the background once per minute
I want a powershell script to be run once per minute in the background. No window may appear. How do I do it?
45 131441
45
Question
I want a powershell script to be run once per minute in the background. No window may appear. How do I do it?
Solution
Use the Windows Task Scheduler and run your script like this:
powershell -File myScript.ps1 -WindowStyle Hidden
Furthermore create the script that it runs under a specific user account and not only when that user is logged on. Otherwise you'll see a console window.
Solution
Schedule your task to be run as System. The command below will schedule a script to be run in the background without showing powershell console window:
schtasks /create /tn myTask /tr "powershell -NoLogo -WindowStyle hidden -file myScript.ps1" /sc minute /mo 1 /ru System
/ru
switch lets you change the user context in which the scheduled task will be executed.