Module: check_mk
Branch: master
Commit: b308cef32e08abc84ba623d75c16cdc9625b7c46
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b308cef32e08ab…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Sat Aug 30 11:42:47 2014 +0200
#0652 windows software inventory gives some more details about OS and installed software
most notably the installation date of the OS and a description and version number for exe
files
---
.werks/652 | 10 ++++++++++
ChangeLog | 2 ++
agents/windows/plugins/mk_inventory.ps1 | 12 ++++++------
inventory/win_exefiles | 5 ++++-
4 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/.werks/652 b/.werks/652
new file mode 100644
index 0000000..0c7d8fc
--- /dev/null
+++ b/.werks/652
@@ -0,0 +1,10 @@
+Title: windows software inventory gives some more details about OS and installed
software
+Level: 1
+Component: inv
+Compatible: incomp
+Version: 1.2.5i6
+Date: 1409391576
+Class: feature
+
+most notably the installation date of the OS and a description and version number for exe
files
+
diff --git a/ChangeLog b/ChangeLog
index ecaca25..593b619 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -98,6 +98,8 @@
HW/SW-Inventory:
* 0643 windows inventory: OS now contains the install date, reg_uninstall now
contains the path...
NOTE: Please refer to the migration notes!
+ * 0652 windows software inventory gives some more details about OS and installed
software...
+ NOTE: Please refer to the migration notes!
1.2.5i5:
diff --git a/agents/windows/plugins/mk_inventory.ps1
b/agents/windows/plugins/mk_inventory.ps1
index 1bb89b0..8882b5a 100644
--- a/agents/windows/plugins/mk_inventory.ps1
+++ b/agents/windows/plugins/mk_inventory.ps1
@@ -1,4 +1,5 @@
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
+write-output "" # workaround to prevent the byte order mark to be at the
beginning of the first section
$name = (Get-Item env:\Computername).Value
$separator = "|"
# filename for timestamp
@@ -30,7 +31,7 @@ Get-WmiObject Win32_Processor -ComputerName $name | Select
Name,Manufacturer,Cap
# OS Version
write-host "<<<win_os:sep(124):persist($until)>>>"
-Get-WmiObject Win32_OperatingSystem -ComputerName $name -Recurse | foreach-object {
write-host -separator $separator $_.csname, $_.caption, $_.version, $_.OSArchitecture,
$_.servicepackmajorversion, $_.ServicePackMinorVersion }
+Get-WmiObject Win32_OperatingSystem -ComputerName $name -Recurse | foreach-object {
write-host -separator $separator $_.csname, $_.caption, $_.version, $_.OSArchitecture,
$_.servicepackmajorversion, $_.ServicePackMinorVersion, $_.InstallDate }
# Memory
#Get-WmiObject Win32_PhysicalMemory -ComputerName $name | select
BankLabel,DeviceLocator,Capacity,Manufacturer,PartNumber,SerialNumber,Speed
@@ -54,15 +55,14 @@ Get-WmiObject Win32_VideoController -ComputerName $name | Select Name,
Descripti
# Installed Software
write-host "<<<win_wmi_software:sep(124):persist($until)>>>"
-Get-WmiObject -Class Win32_Product -ComputerName $name | foreach-object { write-host
-separator $separator $_.Name, $_.Vendor, $_.Version, $_.InstallDate }
-Get-WmiObject Win32_Product -ComputerName $name | foreach-object { write-host -separator
$separator $_.Name, $_.Vendor, $_.Version, $_.InstallDate }
+Get-WmiObject Win32_Product -ComputerName $name | foreach-object { write-host -separator
$separator $_.Name, $_.Vendor, $_.Version, $_.InstallDate }
# Search Registry
write-host
"<<<win_reg_uninstall:sep(124):persist($until)>>>"
$paths = @("HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall")
foreach ($path in $paths) {
- Get-ChildItem $path -Recurse | foreach-object { $path2 =
$path+"\"+$_.PSChildName; get-ItemProperty -path $path2 |
- foreach-object { write-host -separator $separator $_.DisplayName, $_.Publisher,
$_.PSParentPath, $_.PSChildName, $_.DisplayVersion, $_.EstimatedSize, $_.InstallDate }}
+ Get-ChildItem $path -Recurse | foreach-object { $path2 =
$path+"\"+$_.PSChildName; get-ItemProperty -path $path2 |
+ foreach-object { write-host -separator $separator $_.DisplayName, $_.Publisher,
$path, $_.PSChildName, $_.DisplayVersion, $_.EstimatedSize, $_.InstallDate }}
}
# Search exes
@@ -72,7 +72,7 @@ foreach ($item in $paths)
{
if ((Test-Path $item -pathType container))
{
- Get-ChildItem -Path $item -include *.exe -Recurse | foreach-object { write-host
-separator $separator $_.Fullname, $_.LastWriteTime, $_.Length }
+ Get-ChildItem -Path $item -include *.exe -Recurse | foreach-object { write-host
-separator $separator $_.Fullname, $_.LastWriteTime, $_.Length,
$_.VersionInfo.FileDescription, $_.VersionInfo.ProductVersion, $_.VersionInfo.ProductName
}
}
}
diff --git a/inventory/win_exefiles b/inventory/win_exefiles
index a04d61c..c9935a0 100644
--- a/inventory/win_exefiles
+++ b/inventory/win_exefiles
@@ -33,7 +33,7 @@
def inv_win_exefiles(info):
paclist = inv_tree("software.packages:")
- for full_name, write_time, size in info:
+ for full_name, write_time, size, description, product_version, product_name in info:
parts = full_name.split('\\')
entry = {
"name" : parts[-1],
@@ -41,6 +41,9 @@ def inv_win_exefiles(info):
"package_type" : "exe",
"install_date" : write_time,
"size" : int(size),
+ "version" : product_version,
+ "summary" : description,
+ "vendor" : product_name,
}
paclist.append(entry)