i obtained bios data , saved in html file dont want data in file , need format suite requirement.
code :
$bios = get-wmiobject -class "win32_bios" -namespace "root\cimv2" [string]$body = $bios | convertto-html -as list| out-file c:/d/d/test.htm
so based on discussion in comments, think looking this:
function getcompinfowork { param ( [string]$computername,[string]$logfile ) $os = get-wmiobject win32_operatingsystem -computername $computername $bios = get-wmiobject win32_bios -computername $computername $disk = get-wmiobject win32_logicaldisk -filter "deviceid= 'c:'" ` -computername $computername $obj = new-object -typename psobject $obj | add-member -membertype noteproperty ` -name computername -value ($os.csname) $obj | add-member -membertype noteproperty ` -name manufacturer -value ($bios.manufacturer) $obj | add-member -membertype noteproperty ` -name sysdrivefree -value ($disk.freespace / 1gb -as [int]) $obj | add-member -membertype noteproperty ` -name serialnumber -value ($bios.serialnumber) $obj | add-member -membertype noteproperty ` -name version -value ($bios.version) write-output $obj } function get-compinfo { param ([string[]]$computername,[string]$logfile ) begin { $usedparamater = $false if ($psboundparameters.containskey('computername')) { $usedparamater = $true } } process { if ($usedparamater) { foreach ($computer in $computername) { getcompinfowork -computername $computer ` -logfile $logfile } } else { getcompinfowork -computername $_ ` -logfile $logfile } } end {} } get-compinfo -computername localhost | convertto-html | out-file c:\output.html
Comments
Post a Comment