Welcome to! My name is Anders Bengtsson and this is my blog about Azure infrastructure and system management. I am a senior engineer in the FastTrack for Azure team, part of Azure Engineering, at Microsoft. has two main purposes, first as a platform to share information with the community and the second as a notebook for myself.

Everything you read here is my own personal opinion and any code is provided "AS-IS" with no warranties.

Anders Bengtsson

MVP awarded 2007,2008,2009,2010

My Books
Service Manager Unleashed
Service Manager Unleashed
Orchestrator Unleashed
Orchestrator 2012 Unleashed
Inside the Microsoft Operations Management Suite

Ping script

This script ping different machines. If a machine dont answer a local event will ge generated. If you set strLog to 1 a event will be generated for every successful ping.  You will need to create a parameter named Hosts that contains all hosts you want to ping.

' If strLog = "1" then a event will be generated for
' success ping.
' This script use one parameter called "Hosts".
' Value for this can be like this
' Version 2.0

aMAchines = Split(ScriptContext.Parameters.Get("Hosts"), ",")
strLog = "0"
For Each machine in aMachines
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
ExecQuery("select * from Win32_PingStatus where address = '"_
& machine & "'")
For Each objStatus in objPing
If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then
Set objShell = CreateObject("Wscript.Shell")
objShell.LogEvent EVENT_WARNING, _
"Computer " & machine & " is not reachable (" & strLog & ")"

IF strLog = 1 Then
Set objShell = CreateObject("Wscript.Shell")
objShell.LogEvent EVENT_SUCCESS, _
"Computer " & machine & " is reachable"

End If
End If