Blog
Projects
About
Backtrack:
Blog
›
PowerCLI: get a list of VMs, t…
Email this to a friend
PowerCLI: get a list of VMs, their folder and datastore
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
...
read more
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.
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.
Tags
computer
windows
software
vmware
microsoft
linux
exchange
hardware
network
news
mac
powershell
home
office365
msoffice
ad
sqlserver
server
dell
soaring
mssql
internet
esx
rds
sbs
events
powercli
terminalserver
virtualization
antivirus
Archive
«
‹
December 2024
›
»
Sun
Mon
Tue
Wed
Thu
Fri
Sat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Links
-
@harkx
-
Cats & Dogs
-
Jargon-free Security Guide
Quote
«
When a bird does poo poo in your eye, be happy elephants don't fly.
»
Contact
© 2009-2024 Black Manticore – all rights reserved
code by
lunarg
, design by
SuriAmanah
, hosted at Cats&Dogs