Need vbscript that can pop up alert when services go down on a remote computer
I have tried many scripts at my local machine. It gave pop up when service for one particular application went down. But the same thing is not happening for the remote computer. Please look at the script below:
strComputer = "."
Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
objPolicy.FirewallEnabled = FALSE
Set objAdminSettings = objPolicy.RemoteAdminSettings
objAdminSettings.Enabled = TRUE
Set oWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & sComputerName& "\root\cimv2")
Set colRunningServices = oWMIService.ExecQuery _
("SELECT * FROM Win32_Service)
For Each oService in colRunningServices
Wscript.Echo oService.DisplayName & VbTab & oService.State
Next
I have tried without the firewal and admin rights settings as well in the above code and giving the IP address of the remote computer in strcomputer="IP Address"
It doesn't work. Could you please help me out in knowing the problem with the above or give me some code which can do the purpose.
Awaiting eagerly for your response.
Many Thanks.
Naaz.



