- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You mean like this ?
import-module CimCmdlets
$HostUsername = "root"
$HostReport = @()
$CIOpt = New-CimSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -Encoding Utf8 -UseSsl
Get-VMHost | %{
$Session = New-CimSession -Authentication Basic -Credential $HostUsername -ComputerName $_.Name -port 443 -SessionOption $CIOpt
Get-CimInstance -CimSession $Session -ClassName CIM_Chassis | % {
$Report = ""| Select HostName, Model, SerialNumber, AssetTagInfo
$Report.HostName = $_.PSComputerName
$Report.Model = $_.Model
$Report.SerialNumber = $_.SerialNumber
$Report.AssetTagInfo = $_.OtherIdentifyingInfo
$HostReport += $Report
}
}
$HostReport | Sort-object -Property HostName | Export-Csv ".\HostHardwareReport.csv" –NoTypeInformation
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference