Export virtual machine name, folder, datastore and notes

From roonics
Revision as of 14:56, 31 July 2019 by Jlambert (talk | contribs) (Created page with "This script will give you the virtual machine name, folder, datastore and notes as below: <pre> Get-VM | Select Name, @{N="Datastore";E={[string]::Join(',',(Get-Datastore -Id...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This script will give you the virtual machine name, folder, datastore and notes as below:

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

Example output:


Name            Datastore                           Folder                     Notes
----            ---------                           ------                     -----
Server01        iscsi_datastore01                   Domain controllers         Domain controler
Server02        fc_datastore01                      Misc servers               FTP Server
Server03        fc_datastore01                      UK servers                 Doc share