Thursday, 31 October 2019

Scheduled Snapshot Purge Script - Part 2 of 2) Setting up a Scheduled Task

In order to setup the scheduled task.

1) Create Basic Task Wizard: Create a Basic Task
Name = Snapshot Purge
NEXT>

Image: Create Basic Task Wizard: Create a Basic Task

2) Create Basic Task Wizard: Task Trigger
When do you want the task to start? Daily
NEXT>

Image: Create Basic Task Wizard: Task Trigger

3) Create Basic Task Wizard: Daily
Choose when you want the task to start and recur.
NEXT>

Image: Create Basic Task Wizard

4) Create Basic Task Wizard: Action
What action do you want the task to perform? Start a program

Image: Create Basic Task Wizard: Action

5) Create Basic Task Wizard: Start a Program
Program/script: powershell.exe
Add arguments (optional): -Noninteractive -Noprofile -Command "&C:\scripts\snapshotdeletor.ps1"
Start in (optional): C:\scripts
NEXT>

Note: To run the script from command prompt you’d use>
powershell.exe -Noninteractive -Noprofile -Command "&C:\scripts\snapshotdeletor.ps1"

Image: Create Basic Task Wizard: Start a Program

6) Create Basic Task Wizard: Summary
Tick ‘Open the Properties dialog for this task when I click Finish’
Click FINISH

Image: Create Basic Task Wizard: Summary

7) Snapshot Purge Properties (Local Computer)
Be sure to select:
Run whether user is logged on or not
Run with highest privileges
Click OK

And enter the password for the account running the task.
Click OK

Image: Snapshot Purge Properties (Local Computer)

THE END

No comments:

Post a Comment