System Center Orchestrator 2012 : PingList RunBook

Today, I will show how to create a simple Ping List Runbook with System Center Orchestrator 2012.

The main idea is to have a text file as input, this text file contains just a list of computers that we want to ping. As output, we want to have the computer name and next to it, a False or True value depending of the ping command succeeded or not.

So Let’s playing with System Center Orchestrator 2012

1. Open the System Center Orchestrator Runbook Designer.

2. Create a new folder and in it, create a new Runbook.

3. We will use the following activities :

4. Link each activity with the one on the right, and we will rename the activities for having a clear view of what our Runbook will do.

5. We will now create the variables that we will use in our Runbook. Go to Global Settings > Variables and create a new folder.

6. Create 3 new variables :

Filepath : Path to the text file that contains the computer names that we want to ping.

OutputFolder : Folder that will contain the result file of this PingList runbook.

TimeOut : Value that we want to use with the ping command.

7. Go back to the PingList Runbook and open the Initialize Data activity. As in this Runbook, we will directly use variables, we don’t have to add anything here. So leave it blank as default. I supposed that you notice that this Initialize Data activity correspond to the Custom Start activity available in Opalis, Microsoft just renamed it.

8. We use the Format Date/Time activity to add the Date and Time in the name of the output file. In the Input part, Date/Time field, do a right click and select Subscribe > Returned Data.

9. Check the box Show common Returned Data, and select the Activity start time variable.

10. In the Output part, we format the date in that way : M-d-yyyy_h-m-s. Of course, you could chose your own date/time format, just don’t forget that file name has some character restrictions.

11. The Format Date/Time activity must be similar to that:

12. In the Read Line activity, we have to specify the file in which we will read the computer names. In the File field, do a right click > Subscribe > Variable and select the FilePath variable that we defined earlier. As we want to read the input file until the end, we have to add the 1-END in the line numbers field.

13. The Ping activity is in fact a PowerShell function that I wrote some years ago. This function simply takes the computer name and a timeout value as input and return TRUE if the computer answered to ping and FALSE if not.

$reply = $ping.Send($strComputer, $timeout); if( $reply.Status -eq “Success” ) { return $true; } return $false; }EDIT : TrondHindenes, one
of our user group member noticed that indeed of the PowerShell function that I
propose, we could simply use the following PowerShell command : test-connection –quietWhich return directlyTrue or False. Thanks to him !

Just below this PowerShell function in the Run .Net activity, we have to call the function and specify the inputs like below :

14. Still in the Run .Net activity don’t forget to publish the output :

15. In the Output activity, we will specify the name of the output file like below:{OutputFolder}PingResult-{format Result from “Format Date/Time”}.txt

Each line will have the following format: {Line text from “Read Line”},{PingStatus from “Ping”}

16. “Et voilà”, now we just have to test our new PingList Runbook. Go to your input file and specify some computer names.

17. Start the PIngList Runbook :

18. Confirm that the Runbook ran successfully:

19. Go to the output folder, we have now a new file with the results of our Ping.

20. Finally, enjoy the result

You could download this complete PingList Runbook at the following address : DOWNLOAD

About Christopher Keyaert

Christopher Keyaert is a Consultant, focused on helping partners to leverage the System Center and Microsoft Azure cloud platform. He is also a Microsoft Most Valuable Professional (MVP) for Cloud and Data Center Management and a Microsoft Certified Trainer (MCT).