Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Note: You must have permission to run script see ExecutionPolicy

Then in Task Scheduler, the most important/tricky part is the "Action"

It should be "Start a Program"

Program/Script: 

powershell

Add arguments (optional) :

-windowstyle hidden -command full\path\script.ps1 >> "%TEMP%\StartupLog.txt" 2>&1

Note:

  • If you see "-File" on the internet, it will work, but understand nothing can be after "-File" exept the File Path, IE: The redirect is taken to be part of the file path and it fails, you must use "-command" in conjunction with redirect, but you can prepend additional commands/arguments such as "-windowstyle hidden" to not show powershell window.
  • I had to adjust all "Write-Host" to "Write-Output"
  • No labels