Hey Guys,
Why is this script not working.
I dont get the array populated with the host names and versions.
Get-view -ViewType HostSystem -Property Name, Config.Product | select Name, {$_.Config.Product.version} | %{if($_.Config.Product.FullName -eq "3.5.0")
{ $vmarray += $_ }
I want to then do a foreach on that vmarray as following.
Foreach($esx in $vmarray){
$parent = $esx.Name.ExtensionData.Parent
$loc = Get-View $parent
while($loc.getType().Name -ne "Datacenter"){
$parent = $loc.Parent
$loc = Get-View $parent
}
$loc.Name
}
which gives me the datacenter name as well where the host is - finally i will push these to a csv.
Where is the script screwing up?
Thanks
RJ