Anything for sysadmins!


Scheduling PowerShell scripts

Most of the management tasks for desktops and server systems can be done by using PowerShell. However, some of these tasks have to be scheduled on certain events or times. This isn't as straight forward as you might think because you can't just call the script directly. The way described below works for me all the time.

  1. Start Task Scheduler
  2. Select Task Scheduler Library and right-click it
  3. Select Create Task
  4. Define your security options and triggers
  5. On the Actions tab click the New button
  6. You can leave the Action as it is. In the Program/script field enter: powershell.exe
    In the Add arguments field enter: -command "&"{<full path to script }""
    In the Start in field you can enter anything you would like or leave it empty

You can test run the task by right-clicking it and selecting Run. The column Last Run Result will show the outcome.