Can't execute a Nagios plugin wmi for wql
Posted: Tue Apr 07, 2015 4:35 am
i want to execute a wmi query passing only 2 parameter. For example please take a look at my vbs script below. In this example I want pass the first sql query parameter ("Select * from Win32_ComputerSystem") and the second parameter ("UserName"). I try it using the standard plugin check_wmi_plus.pl but it doesnt' works. Maybe I have to use other solutions. Please help me as soon as possible. Thanks a lot. Bye, Kalibert
' -----------------------------------------------'
' Sample VBScript to discover which user is logged on
' -----------------------------------------------'
Option Explicit
Dim objWMIService, objComputer, colComputer, strComputer
strComputer = "MyPcName"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
Wscript.Echo objComputer.UserName
Next
' -----------------------------------------------'
' Sample VBScript to discover which user is logged on
' -----------------------------------------------'
Option Explicit
Dim objWMIService, objComputer, colComputer, strComputer
strComputer = "MyPcName"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
Wscript.Echo objComputer.UserName
Next