Powershell command as scheduled task

Here’s the syntax to use a PowerShell command in Task Schedule action, rather than a script:

Program/script:

powershell.exe

Add Arguments:

-noninteractive -executionpolicy bypass -command &{Checkpoint-VM -Name pxetest -SnapshotName 2018-06-23-PreMaintenance}

 

The key here is the ampersand before the command – when I was missing that it would not run.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.