Wednesday, September 22, 2021

Execute PowerShell in Windows Scheduled Task

 There are many ways to execute PowerShell in Windows scheduled tasks:

Option #1

Program/Script: PowerShell.exe

Add arguments (optional): -command "& {& 'C:\path\to\script.ps1'}"

Start in (optional): C:\path\to\

Option #2

Program/Script: PowerShell.exe

Add arguments (optional): -NonInteractive -Noprofile -File "C:\path\to\script.ps1"

Start in (optional): C:\path\to\

Option #1 allows me to have the script to connect to the Internet (server is located behind corporate proxy). 

1 comment:

amazingwebdeveloper said...

You have explained it so well. DevOps developers differ from software engineering in focusing on outcomes rather than specific practices; for example, automating all the steps of a software delivery pipeline may be considered a practice within Software Engineering but is not generally considered DevOps unless it improves the overall outcome of the project.