Report with multiple WMI properties
i know easy question cant work out. have been trying set basic inventory script query via wmi number of servers.
i can of display correctly except array config using root/hpq namespace. trying report array types using elementname property.
as there more 1 array configuration on servers, report show 1 of configurations.
im guessing need foreach somewhere cant work out where!
also, im wondering if way im trying output exported excel file? or should outputting via different method.
thanks
f
'server1','server2'|foreach { $computer = get-wmiobject win32_computersystem -computername $_ -credential $cred $array = (gwmi -computername $_ -namespace root/hpq -class hpsa_storagesetting -credential $cred) $bios = get-wmiobject win32_bios -computername $_ -credential $cred $os = get-wmiobject win32_operatingsystem -computername $_ -credential $cred $report = @{} $report.name = $computer.name foreach ($arrays in $array){ $report.array = $arrays.elementname } $report.make = $computer.manufacturer $report.model = $computer.model $report.serialnumber = $bios.serialnumber $report.ipaddress = (test-connection -count 1 -computername $_).ipv4address $report.os = $os.caption $report.memory = $computer|foreach-object {$([math]::round(($_.totalphysicalmemory / 1gb),2))} new-object psobject -property $report|select-object name,make,model,serialnumber,ipaddress,os,memory,array}
here unversial solution this:
windows powershell best inventory tool ever! superstar don jones!
http://64.4.10.145/en-us/magazine/dd392028
please click “mark answer” on post helps you. thank ;-)) bitte markiere hilfreiche beiträge von mir als "hilfreich" und beiträge die deine frage ganz oder teilweise beantwortet haben als "antwort". das wäre nett :-))
Windows Server > Windows PowerShell
Comments
Post a Comment