Pages: [1]   Go Down
Author Topic: Pandora Agent WMI query using non-standard namespace  (Read 545 times)
0 Members and 2 Guests are viewing this topic.
FMSer
Newbie
*

Karma: 0
Offline Offline

Posts: 7


View Profile
« on: November 17, 2010, 05:55:31 PM »

I would like to add a module to my LDAP server to get some AD information.  As an example, I can run the following WMIC query to get an email address from the Pandora server:

wmic --namespace="root\directory\LDAP" -U "DOMAIN\user"%MyPassword //AD-DC1 "Select ds_mail From ds_user WHERE ds_samaccountname='userID'"

I have obviously removed the sensitive info, but can a pandora_agent.conf file use this different namespace, or any other non ROOT\CIMv2 namespace?

Thanks.
Logged

raul
Administrator
Expert member
*****

Karma: 1
Offline Offline

Posts: 576



View Profile
« Reply #1 on: November 29, 2010, 04:12:32 PM »

You can create a vbs file like this (check syntax and options, but the idea is this):

Set objWMI = GetObject("winmgmts:root\directory\LDAP")

Set colObjets = objWMI.ExecQuery _
(-U "DOMAIN\user"%MyPassword //AD-DC1 "Select ds_mail From ds_user WHERE ds_samaccountname='userID'")

For Each objObjet in colObjets
WScript.Echo (objObjet.ds_mail)
Next


Save it like mail.vbs and test if it works (gives your desired output) with

cscript //Nologo mail.vbs

Then, add an exec module like:

module_begin
module_name Mail
module_type generic_data_string
module_exec cscript //Nologo mail.vbs
module_description Mail
module_end


Of course, change at will.


cscript //Nologo mail.vbs
Logged

Pages: [1]   Go Up
Print
 
Jump to:  


SourceForge.net Logo  This site is monitored by Pandora FMS   ArticaST