powershell - Run script using Task Scheduler with user context complete silent with no popup or cmd flash -
i have tried run script using command
cmd.exe /c start /min powershell.exe -windowstyle hidden -file <file>.ps1
but getting cmd window fraction of second. need run hidden.
i have had issue , way fix call powershell script simple vbs wrapper:
https://github.com/gbuktenica/psrun
http://blog.buktenica.com/run-a-powershell-task-silently/
' synopsis ' run powershell script in user context without script window ' example ' wscript.exe psrun.vbs mypsscript.ps1 ' author ' glen buktenica set objshell = createobject("wscript.shell") set args = wscript.arguments each arg in args dim psrun psrun = "powershell.exe -windowstyle hidden -executionpolicy bypass -noninteractive -file " & arg objshell.run(psrun),0
Comments
Post a Comment