Pandora FMS Agent Windows inventory fixes
This commit is contained in:
parent
a3a38c9bb6
commit
257b6c4f2d
|
@ -2,24 +2,34 @@
|
|||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI architecture
|
||||
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Architecture</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set cols = objWMIService.ExecQuery("Select osarchitecture from Win32_OperatingSystem")
|
||||
|
||||
For Each data In cols
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & data.osarchitecture & "]]></data>"
|
||||
Next
|
||||
on error resume next
|
||||
flag = cols.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Architecture</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
For Each data In cols
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & data.osarchitecture & "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
End If
|
||||
|
|
|
@ -2,28 +2,39 @@
|
|||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI CD_ROM_drives_info
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>CDROM</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colCDROMDrives = objWMIService.ExecQuery("Select caption,description,drive,deviceid from win32_CDROMDrive")
|
||||
|
||||
For Each cdromd In colCDROMDrives
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & cdromd.caption _
|
||||
& ";" & cdromd.description _
|
||||
& ";" & cdromd.drive _
|
||||
& ";" & cdromd.deviceid _
|
||||
& "]]></data>"
|
||||
Next
|
||||
on error resume next
|
||||
flag = colCDROMDrives.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>CDROM</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
For Each cdromd In colCDROMDrives
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & cdromd.caption _
|
||||
& ";" & cdromd.description _
|
||||
& ";" & cdromd.drive _
|
||||
& ";" & cdromd.deviceid _
|
||||
& "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
|
||||
End If
|
|
@ -2,24 +2,34 @@
|
|||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI cpuinfo
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>CPU</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colCPUs = objWMIService.ExecQuery("Select name,maxclockspeed,caption from Win32_Processor")
|
||||
|
||||
For Each cpu In colCPUs
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & cpu.name & ";" & cpu.maxclockspeed & " MHz;" & cpu.caption & "]]></data>"
|
||||
Next
|
||||
on error resume next
|
||||
flag = colCPUs.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>CPU</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
For Each cpu In colCPUs
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & cpu.name & ";" & cpu.maxclockspeed & " MHz;" & cpu.caption & "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
End If
|
||||
|
|
|
@ -2,33 +2,43 @@
|
|||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI disksinfo
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>HD</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colHDDs = objWMIService.ExecQuery("Select * from win32_diskdrive")
|
||||
|
||||
For Each disco In colHDDs
|
||||
If ((not IsNull(disco.size)) AND (disco.size > 0)) then
|
||||
Wscript.StdOut.Write "<data><![CDATA[" & disco.caption _
|
||||
& ";" & Abs(Round((disco.size/(1024*1024*1024)),2)) & " GB"
|
||||
If (not IsNull(disco.serialnumber)) then
|
||||
Wscript.StdOut.Write ";" & disco.serialnumber
|
||||
Else
|
||||
Wscript.StdOut.Write ";" & disco.signature
|
||||
on error resume next
|
||||
flag = colHDDs.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>HD</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
For Each disco In colHDDs
|
||||
If ((not IsNull(disco.size)) AND (disco.size > 0)) then
|
||||
Wscript.StdOut.Write "<data><![CDATA[" & disco.caption _
|
||||
& ";" & Abs(Round((disco.size/(1024*1024*1024)),2)) & " GB"
|
||||
If (not IsNull(disco.serialnumber)) then
|
||||
Wscript.StdOut.Write ";" & disco.serialnumber
|
||||
Else
|
||||
Wscript.StdOut.Write ";" & disco.signature
|
||||
End If
|
||||
Wscript.StdOut.WriteLine "]]></data>"
|
||||
End If
|
||||
Wscript.StdOut.WriteLine "]]></data>"
|
||||
End If
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
End If
|
||||
|
|
|
@ -2,24 +2,34 @@
|
|||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI domain/workgroup info
|
||||
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Domain</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
|
||||
Set colItems = objWMIService.ExecQuery("SELECT Domain FROM Win32_ComputerSystem")
|
||||
For Each objItem In colItems
|
||||
WScript.StdOut.WriteLine "<data><![CDATA[" & objItem.Domain & "]]></data>"
|
||||
Next
|
||||
|
||||
on error resume next
|
||||
flag = colItems.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Domain</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
For Each objItem In colItems
|
||||
WScript.StdOut.WriteLine "<data><![CDATA[" & objItem.Domain & "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
End If
|
|
@ -2,7 +2,6 @@
|
|||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI real interfaces info
|
||||
' exlusions:
|
||||
' VBox network interfaces
|
||||
|
@ -10,12 +9,6 @@ on error resume next
|
|||
'
|
||||
'nic where "guid is not null and not PNPDeviceID like 'ROOT%'"
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>NIC</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter " & _
|
||||
|
@ -24,19 +17,37 @@ Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter "
|
|||
"and not ServiceName is null " & _
|
||||
"and not ServiceName like 'vwifimp' ")
|
||||
|
||||
For Each iface In colAdapters
|
||||
' return model MACAddress IPAddress
|
||||
on error resume next
|
||||
flag = colAdapters.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
set ifaces_cfg = objWMIService.ExecQuery("Select ipaddress from Win32_NetworkAdapterConfiguration Where Caption='" & iface.caption & "'")
|
||||
Wscript.StdOut.Write "<data><![CDATA[" & iface.ProductName & ";" & iface.MACAddress & ";"
|
||||
for each iface_cfg in ifaces_cfg
|
||||
if ( iface_cfg.IPAddress(0) <> "" ) then
|
||||
Wscript.StdOut.Write trim(iface_cfg.IPAddress(0))
|
||||
end if
|
||||
next
|
||||
wscript.stdOut.WriteLine "]]></data>"
|
||||
Next
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>NIC</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
For Each iface In colAdapters
|
||||
' return model MACAddress IPAddress
|
||||
|
||||
set ifaces_cfg = objWMIService.ExecQuery("Select ipaddress from Win32_NetworkAdapterConfiguration Where Caption='" & iface.caption & "'")
|
||||
Wscript.StdOut.Write "<data><![CDATA[" & iface.ProductName & ";" & iface.MACAddress & ";"
|
||||
for each iface_cfg in ifaces_cfg
|
||||
if ( iface_cfg.IPAddress(0) <> "" ) then
|
||||
Wscript.StdOut.Write trim(iface_cfg.IPAddress(0))
|
||||
end if
|
||||
next
|
||||
wscript.stdOut.WriteLine "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
End If
|
|
@ -2,25 +2,35 @@
|
|||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI mobo info
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Motherboard</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
'Set colMobos = objWMIService.ExecQuery("Select name,product,manufacturer from Win32_baseboard")
|
||||
Set colMobos2 = objWMIService.ExecQuery("Select manufacturer,model,OEMStringArray from Win32_computersystem")
|
||||
|
||||
For Each mobo In colMobos2
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & mobo.manufacturer & ";" & mobo.model & ";" & mobo.OEMStringArray(0) & "]]></data>"
|
||||
Next
|
||||
on error resume next
|
||||
flag = colItems.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Motherboard</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
For Each mobo In colMobos2
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & mobo.manufacturer & ";" & mobo.model & ";" & mobo.OEMStringArray(0) & "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
End If
|
||||
|
|
|
@ -2,28 +2,38 @@
|
|||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI monitorsinfo
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Monitors</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colDisplays = objWMIService.ExecQuery("Select caption,pnpdeviceid from win32_desktopmonitor")
|
||||
|
||||
For Each display In colDisplays
|
||||
if (NOT isNull(display.pnpdeviceid)) then
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & display.caption _
|
||||
& ";" & display.pnpdeviceid _
|
||||
& "]]></data>"
|
||||
end if
|
||||
Next
|
||||
on error resume next
|
||||
flag = colDisplays.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Monitors</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
For Each display In colDisplays
|
||||
if (NOT isNull(display.pnpdeviceid)) then
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & display.caption _
|
||||
& ";" & display.pnpdeviceid _
|
||||
& "]]></data>"
|
||||
end if
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
End If
|
||||
|
|
|
@ -2,24 +2,34 @@
|
|||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI OS version
|
||||
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>OSVersion</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set cols = objWMIService.ExecQuery("SELECT version from win32_operatingsystem")
|
||||
|
||||
For Each data In cols
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & data.version & "]]></data>"
|
||||
Next
|
||||
on error resume next
|
||||
flag = cols.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>OSVersion</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
For Each data In cols
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & data.version & "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
End If
|
|
@ -2,16 +2,8 @@
|
|||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
On Error Resume Next
|
||||
|
||||
'WMI printers attached
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Printers</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
function validPort(port)
|
||||
if strComp(port,"SHRFAX:") = 0 then
|
||||
validPort = false
|
||||
|
@ -31,29 +23,58 @@ end function
|
|||
Set oWMI = GetObject("winmgmts:\\" & "." & "\root\cimv2")
|
||||
Set colPrinters = oWMI.ExecQuery("Select * from Win32_Printer",,48)
|
||||
|
||||
For Each objPrinter in colPrinters
|
||||
if validPort (objPrinter.PortName) then
|
||||
set tcp_port_exists = 0
|
||||
WScript.stdOut.Write "<data><![CDATA[" & _
|
||||
objPrinter.DeviceID & ";" & _
|
||||
objPrinter.DriverName & ";"
|
||||
If (objPrinter.Local) Then
|
||||
Set colPorts = oWMI.ExecQuery("Select HostAddress from Win32_TCPIPPrinterPort where Name like '" & objPrinter.PortName & "'",,48)
|
||||
For Each objPort in colPorts
|
||||
tcp_port_exists = 1
|
||||
Wscript.stdOut.Write objPort.HostAddress
|
||||
Next
|
||||
If (tcp_port_exists = 0) Then
|
||||
Wscript.stdOut.Write objPrinter.PortName
|
||||
on error resume next
|
||||
flag = colPrinters.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Printers</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
For Each objPrinter in colPrinters
|
||||
if validPort (objPrinter.PortName) then
|
||||
set tcp_port_exists = 0
|
||||
WScript.stdOut.Write "<data><![CDATA[" & _
|
||||
objPrinter.DeviceID & ";" & _
|
||||
objPrinter.DriverName & ";"
|
||||
If (objPrinter.Local) Then
|
||||
Set colPorts = oWMI.ExecQuery("Select HostAddress from Win32_TCPIPPrinterPort where Name like '" & objPrinter.PortName & "'",,48)
|
||||
on error resume next
|
||||
flag = colPorts.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
For Each objPort in colPorts
|
||||
tcp_port_exists = 1
|
||||
Wscript.stdOut.Write objPort.HostAddress
|
||||
Next
|
||||
End If
|
||||
If (tcp_port_exists = 0) Then
|
||||
Wscript.stdOut.Write objPrinter.PortName
|
||||
End If
|
||||
Else
|
||||
Wscript.stdOut.Write objPrinter.ServerName
|
||||
End If
|
||||
Else
|
||||
Wscript.stdOut.Write objPrinter.ServerName
|
||||
End If
|
||||
wscript.stdOut.WriteLine "]]></data>"
|
||||
end if
|
||||
Next
|
||||
wscript.stdOut.WriteLine "]]></data>"
|
||||
end if
|
||||
Next
|
||||
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
End If
|
||||
|
|
|
@ -3,21 +3,20 @@
|
|||
' (c) 2015 Sancho Lerena <slerena@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' ----------------------------------------------------------------
|
||||
on error resume next
|
||||
|
||||
Set oShell = WScript.CreateObject ("WScript.Shell")
|
||||
Set objExec = oShell.Exec("cmd.exe /C wmic os get ""SerialNumber"" | find /v ""SerialNumber"" ")
|
||||
|
||||
Do
|
||||
line = objExec.StdOut.ReadLine()
|
||||
s = s & line
|
||||
Loop While Not objExec.Stdout.atEndOfStream
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>product_ID</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
Set oShell = WScript.CreateObject ("WScript.Shell")
|
||||
Set objExec = oShell.Exec("cmd.exe /C wmic os get ""SerialNumber"" | find /v ""SerialNumber"" ")
|
||||
Do
|
||||
line = objExec.StdOut.ReadLine()
|
||||
s = s & line
|
||||
Loop While Not objExec.Stdout.atEndOfStream
|
||||
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & Replace(Replace(s, chr(013), ""), chr(010), "") & "]]></data>"
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
|
|
|
@ -4,22 +4,32 @@
|
|||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' ----------------------------------------------------------------
|
||||
|
||||
on error resume next
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>product_key</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colProducts = objWMIService.ExecQuery("Select OA3xOriginalProductKey from SoftwareLicensingService")
|
||||
|
||||
For Each product In colProducts
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & product.OA3xOriginalProductKey & "]]></data>"
|
||||
Next
|
||||
on error resume next
|
||||
flag = colProducts.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>product_key</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
For Each product In colProducts
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & product.OA3xOriginalProductKey & "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
End If
|
|
@ -2,27 +2,37 @@
|
|||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI raminfo
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>RAM</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colRAMs = objWMIService.ExecQuery("Select deviceLocator,capacity,speed from Win32_PhysicalMemory")
|
||||
|
||||
For Each ram In colRAMs
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & ram.deviceLocator _
|
||||
& ";" & Abs(Round((ram.capacity/(1024*1024)),2)) & " MB" _
|
||||
& ";" & ram.speed & " MHz"_
|
||||
& "]]></data>"
|
||||
Next
|
||||
on error resume next
|
||||
flag = colRAMs.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>RAM</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
For Each ram In colRAMs
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & ram.deviceLocator _
|
||||
& ";" & Abs(Round((ram.capacity/(1024*1024)),2)) & " MB" _
|
||||
& ";" & ram.speed & " MHz"_
|
||||
& "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
End If
|
||||
|
|
|
@ -2,27 +2,39 @@
|
|||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI video_card_info
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Video</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colVideoCards = objWMIService.ExecQuery("Select caption,AdapterRAM,PNPDeviceID from win32_videocontroller")
|
||||
|
||||
For Each vcard In colVideoCards
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & vcard.caption _
|
||||
& ";" & Round(Abs(vcard.AdapterRAM/(1024*1024)),2) & " MB" _
|
||||
& ";" & vcard.PNPDeviceID _
|
||||
& "]]></data>"
|
||||
Next
|
||||
on error resume next
|
||||
flag = colVideoCards.Count
|
||||
If (err.number <> 0) Then
|
||||
flag = true
|
||||
Else
|
||||
flag = false
|
||||
End If
|
||||
on error goto 0
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
'Print only when there's results
|
||||
If (NOT flag) Then
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Video</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
For Each vcard In colVideoCards
|
||||
Wscript.StdOut.Write "<data><![CDATA[" & vcard.caption & ";"
|
||||
on error resume next
|
||||
Wscript.StdOut.Write Round(Abs(vcard.AdapterRAM/(1024*1024)),2) & " MB"
|
||||
on error goto 0
|
||||
Wscript.StdOut.Write ";" & vcard.PNPDeviceID
|
||||
Wscript.StdOut.WriteLine "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
End If
|
||||
|
|
Loading…
Reference in New Issue