Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 293210

Why wont this work?

$
0
0

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


Viewing all articles
Browse latest Browse all 293210

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>