Schedule Diagnostic Tests

This topic describes how to automatically run HPC diagnostic tests on a regular basis on your 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, see Invoke-HpcTest.

To create a .ps1 file that runs all HPC tests

  1. Run Notepad.

  2. Type or paste the following script into a blank document:

    Add-PSSnapin –name “Microsoft.HPC”  
    Get-HpcTest|Invoke-HpcTest –groupname computenodes  
    
  3. 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).

  4. To verify that the script works:

    1. Run an elevated PowerShell window (not HPC PowerShell).

    2. Type the location of the script. For example:

      C:\Users\myLogon\HPCtests.ps1

    3. 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

  1. Log on to the head node as a user with administrative permission.

  2. Click Start, point to Administrative Tools, and then click Task Scheduler.

  3. If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue.

  4. In Task Scheduler, in Actions, and then click Create Task. The Create Task dialog box appears.

  5. In the General tab:

    1. In Name, type: HPC Diagnostics

    2. 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.

  6. In the Trigger tab:

    1. Click New. The New Trigger dialog box appears.

    2. Select the Daily radio button.

    3. Set the start time to 6:00 AM.

    4. Click OK.

  7. In the Actions tab:

    1. Click New. The New Action dialog box appears.

    2. In Settings, in Program/Script, type:

      powershell.exe

    3. 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”

    4. Click OK.

  8. In the Create Task dialog box, click OK. When prompted, enter your password.

  9. Verify that the new task works:

    1. In Task Scheduler, in the navigation pane, select Task Scheduler Library.

    2. In the view pane, right-click HPC Diagnostics, then click Run.

    3. 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.

Additional references