fixed ansible_totalmem fact returning 0
Win32_PhysicalMemory CIM object is busted on some virtual environments, switched to Win32_ComputerSystem.TotalPhysicalMemorypull/4420/head
parent
8eb04fe0d3
commit
45fff5d939
|
@ -26,11 +26,9 @@ $result = New-Object psobject @{
|
||||||
};
|
};
|
||||||
|
|
||||||
$win32_os = Get-CimInstance Win32_OperatingSystem
|
$win32_os = Get-CimInstance Win32_OperatingSystem
|
||||||
|
$win32_cs = Get-CimInstance Win32_ComputerSystem
|
||||||
$osversion = [Environment]::OSVersion
|
$osversion = [Environment]::OSVersion
|
||||||
$memory = @()
|
$capacity = $win32_cs.TotalPhysicalMemory # Win32_PhysicalMemory is empty on some virtual platforms
|
||||||
$memory += Get-WmiObject win32_Physicalmemory
|
|
||||||
$capacity = 0
|
|
||||||
$memory | foreach {$capacity += $_.Capacity}
|
|
||||||
$netcfg = Get-WmiObject win32_NetworkAdapterConfiguration
|
$netcfg = Get-WmiObject win32_NetworkAdapterConfiguration
|
||||||
|
|
||||||
$ActiveNetcfg = @(); $ActiveNetcfg+= $netcfg | where {$_.ipaddress -ne $null}
|
$ActiveNetcfg = @(); $ActiveNetcfg+= $netcfg | where {$_.ipaddress -ne $null}
|
||||||
|
|
Loading…
Reference in New Issue