All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Hi,
We are running AHM 5.66 on Windows Server 2003 sp1.
We have a basic script that checks the status of several services on a remote machine using WMI.
When run interactively, the test runs fine - however, when AHM is running as a service, the test comes up with a status of unknown. As a test, I configured the script to query WMI for service info on the AHM server - this works fine interactively and as a service.
I suspect this has something to do with WMI impersonation or such - any ideas?
FYI, there are admin credentials supplied under options | startup | service. This account has admin rights over the servers.
FUNCTION PerformTest()
strComputer = "xxxx" 'target
i = 0 'count of bad services
BadMessage = "" ' Error Message
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Service Where startmode='Auto' and state='Stopped'", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
SELECT CASE UCASE(objItem.Name)
CASE "EXCLUDEDSERVICE1" ' Enter the name of a serivce that you do not want to monitor here (in ucase)
CASE "EXCLUDEDSERVICE2"
CASE ELSE ' Service should not be excluded
i = i + 1
BadMessage = BadMessage & objItem.Name & " "
END SELECT
Next
IF i < 1 THEN
performtest = statusOk & "All Auto Services Running"
ELSE
performtest = statusBad & " " & i & " Failed Services: " & badMessage
END IF
END FUNCTION
You are right. Something wrong with permissions.
As you wrote above you have supplied admin credentials but
please doublecheck HM service is running under admin account.
There are implemented WMI tests and you could check services without VBScript. Use Connection Manager dialog to setup account for WMI test and WMI Explorer to prepare correct WMI query.
Also you could use "sc" command line utility to check services status.
Regarding WMI test method:
I am afraid WMI test (version 5.82 Beta) will lead to the same problem in service mode. Problem was fixed in version 5.86, should be available for download next week.
Regarding Active Script test method:
We checked the code, HostMonitor tries to use specified user account for Active Script test method. May be account cannot be used for some reason (e.g. password expired)? Could you check NT Event Log (Application)? Any messages from HostMonitor?
Also, can HostMonitor perform CPU Usage or Process test against that remote system?
All of the testing was done with AHM running as a serivce, with only the RCC running.
WMI test: This does not work when AHM is running as a service - EXCEPT if I manually specified additional credentials.
Password: This is fine - tested a \\server\c$ conenction using the credentials - fine.
NT Log: nothing in there on either server in any log.
CPU / Process tests: both of these work 100% OK.
I can do a workaround of using the WMI test rather than calling the activescript, however, I miss out on the response listing all failed services & I cannot filter out problem services (such as USB service). This is why I want to get the script working.
Any other ideas for getting the activescript remote wmi query working?