The location of the Windows Server 2008 Task Scheduler is a little bit changed. You can find it by starting Server manager → Configuration → Task Scheduler. If you created custom tasks you can find them under Task Scheduler → Task Scheduler Library.
In this example I'll create a task for scheduling a powershell/powercli script as explained in
Script: PowerCLI: Daily Check. Before you start creating the task you'll need an service account which has the following permissions:
Logon as a batchjob
Control Panel → Administrative Tools → Open Local Security Policy.
Go to Local Policies → User Rights Assignments.
Go to Log on as a batchjob.
Click Add User or Group, and add the service account to the list of accounts.
vCenter permissions
Than the task:
Click on Create Task
In the General tab:
Give a name and description
Use the created service account to run the task
Set the task to “Run whether user is logged on or not”
Check the “Run with highest privileges
Configure the task for the correct Operating System (Windows Server 2008 / Windows Server 2008 R2)
On the Triggers tab create a new trigger based on what time you want the task to start (Daily - 07:30).
On the Action tab create a new action:
Program/Script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments: -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” ”& 'C:\Users\Public\Documents\dailycheck.ps1'” vcenter
On the Settings tab set the task to stop if it runs longer than 1 hour.
When you click OK the task will ask you for the password of the service account you provided in the General tab.
You can test whether the task runs by right-clicking the task and clicking “run”.
0x1 - Do not create a batch file for the script but set it up as explained above.
0x41301 - Actually, the batch file is running. Please wait for the script to finish.
0x80070569 - The user does not have “logon as a batchjob” permissions. Assign the rights as explained above.
Discussion