Scheduling Diagnostic Tests
This topic describes how to automatically run HPC diagnostic tests on a regular basis in a Windows® HPC Server 2008 cluster. You can write a PowerShell script (.ps1) to invoke the diagnostic tests, and create a task in Windows Task Scheduler to run the script regularly.
This topic describes how to create a simple script that runs all HPC diagnostic tests on the compute nodes. This topic also includes steps for creating a Windows Task Scheduler task that runs the script every morning at 6:00 AM.
You must be an HPC cluster administrator to complete the steps in the following procedures.
Step 1: Create a .ps1 file
To run a .ps1 script from the task scheduler, you must pass it as a parameter to powershell.exe
. The sample script adds the HPC PowerShell snap-in to the current session, and then runs all HPC diagnostic tests on all compute nodes.
Note
You can modify and expand this script to run specific tests on specific sets of nodes. For more information about how to use the Invoke-HpcTest
cmdlet, see Invoke-HpcTest.
To create a .ps1 file that runs all HPC tests
Run Notepad.
Type or paste the following script into a blank document:
Add-PSSnapin –name “Microsoft.HPC” Get-HpcTest|Invoke-HpcTest –groupname computenodes
Save the file as HPCtests.ps1. Be sure to select All Files under Save as type.
By default, the file should be saved in your user profile folder (for example,
C:\Users\myLogon\HPCtests.ps1
).To verify that the script works:
Run an elevated PowerShell window (not HPC PowerShell).
Type the location of the script. For example:
C:\Users\myLogon\HPCtests.ps1
Verify that the tests have started running on all compute nodes. Use HPC Cluster Manager, or run HPC PowerShell as an administrator and type the following cmdlet:
Get-HpcTestResults –testState Running
Step 2: Create a task in Windows Task Scheduler
The following procedure describes how to create a task on the head node that runs the HPCtests.ps1 script every day at 6:00 AM.
Note
You can set up this task on any computer that has the HPC client utilities installed. The scheduled task will start according to the time on the computer on which the task is created. If the computer is in a different time zone from the head node, adjust the start time accordingly.
To create a task in Windows Task Scheduler that runs HPCtests.ps1 every day
Log on to the head node as a user with administrative permission.
Click Start, point to Administrative Tools, then click Task Scheduler.
If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue.
In Task Scheduler, in Actions, click Create Task. The Create Task dialog box appears.
In the General tab:
In Name, type: HPC Diagnostics
In Security Options:
Ensure that the user account that is specified is an account that has administrative permissions on the HPC cluster.
Select the Run whether user is logged on or not radio button.
Select the Run with highest privileges check box.
In the Trigger tab:
Click New. The New Trigger dialog box appears.
Select the Daily radio button.
Set the start time to 6:00 AM.
Click OK.
In the Actions tab:
Click New. The New Action dialog box appears.
In Settings, in Program/Script, type:
powershell.exe
In Add arguments, type the following, where C:\Users\myLogon\HPCtests.ps1 is the location of the script that you want to run:
-command “C:\Users\myLogon\HPCtests.ps1”
Click OK.
In the Create Task dialog box, click OK. When prompted, enter your password.
Verify that the new task works:
In Task Scheduler, in the navigation pane, select Task Scheduler Library.
In the view pane, right-click HPC Diagnostics, then click Run.
Verify that the tests have started running on all compute nodes. Use HPC Cluster Manager, or run HPC PowerShell as an administrator and type the following cmdlet:
Get-HpcTestResults –testState Running
Note
To edit the task, right-click the task in the view pane, then click Properties.