Email this to a friend
 
posted on December 12th 2017, at 12:35
by lunarg
When performing large storage migrations, it may be useful to get a list of VMs and the datastore and/or folder they are located in. PowerCLI can provide this very quickly:

Get-VM | Select Name,@{N="Datastore";E={[string]::Join(',',(Get-Datastore -Id $_.DatastoreIdList | Select -ExpandProperty Name))}},@{N="Folder";E={$_.Folder.Name}}

You can further pipe this to other cmdlets (such as Where-Object to filter even more), or export it to a CSV.

You can also go into more detail and determine the location of each virtual disk (VMDK) of each VM:

Get-VM | Get-View | % { $name = $_.Name $_.Layout.Disk | % { New-Object PSObject -Property @{ Nam  ...

Send a link to this post to yourself or a friend.

Send to e-mail:
Your name:
Your e-mail:
Captcha:
Type the letters and numbers as shown.
/get/captcha/1732183123
Not readable? Get another.
 
Information entered is solely used for sending a one-time e-mail, and is not retained and/or passed on to a third party.
 
 
 
 
« November 2024»
SunMonTueWedThuFriSat
     12
3456789
10111213141516
17181920212223
24252627282930
 
Links
 
Quote
« I needed a password with eight characters so I picked Snow White and the Seven Dwarves. »