Hi,
One thing i like about Connect-Viserver is the fact that you can connect to multiple vCenters by using servernames and then collect the required object info in one single call.
Like this:
Connect-viserver -Server
$row.Name = $_.name
$row.Vendor = $_.Summary.Hardware.vendor
$row.Model = $_.Summary.Hardware.model
$row.HBAs = $_.Summary.Hardware.NumHBAs
How to retrieve this part?
$row.=??????
$report += $row
}
$report | Export-csv $InvFile -NoTypeInformation
How do i retrieve the missing part? Is it possible?
thanks in advance
A.S
Environment: vCenter 2.5 U6 /ESX 3.5 U6 /Powercli 4.1
Here is how you can do that:
$report = @() Get-View -ViewType HostSystem | % { $row = "" | select Name, Vendor, Model, HBAs, Vc $row.Name = $_.name $row.Vendor = $_.Summary.Hardware.vendor $row.Model = $_.Summary.Hardware.model $row.HBAs = $_.Summary.Hardware.NumHBAs $row.Vc = $_.Client.ServiceUrl.Split('/') | where {$_ -like "[1-9]*"} $report += $row }
Best regards,
Yavor
Thank you,
it works. I made a little modification in order to retrieve only required part of string
$report = @()
Get-View -ViewType HostSystem | % {
$row = "" | select Name, Vendor, Model, HBAs, Vc
$row.Name = $_.name
$row.Vendor = $_.Summary.Hardware.vendor
$row.Model = $_.Summary.Hardware.model
$row.HBAs = $_.Summary.Hardware.NumHBAs
$row.Vc = $_.Client.ServiceUrl.Split('/')[2]
$report += $row
}