Quantcast
Channel: VMware Communities : All Content - VMware vCenter™
Viewing all articles
Browse latest Browse all 24426

Virtual machine Datastore retrieval

$
0
0

I have the following code

 

Connect-VIServer -Server <ServerName> -Protocol https

$VM1 = Get-VM

for($i = 0; $i -lt $VM1.Count; $i++) {

      $datastore = Get-Datastore -VM (Get-VM -Name $VM1.SyncRoot[$i].Name)

      Write-Host $datastore.Name

     }

 

My problem is that sometimes the datastore is returned and others it is not. Either way there are no errors returned.


Viewing all articles
Browse latest Browse all 24426

Trending Articles



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