Script to List VM and associated folder and Datastore name
Save the below script as .PS1 extension and Run fron vSphere Power CLI , Out Put will be saved on the Location where we mention , here it is D:\share\vmname.csv
Get-VM |
Select Name,
@{N="Datastore";E={[string]::Join(',',(Get-Datastore -Id $_.DatastoreIdList | Select -ExpandProperty Name))}},
@{N="Folder";E={$_.Folder.Name}} | export-csv D:\share\vmname.csv
Save the below script as .PS1 extension and Run fron vSphere Power CLI , Out Put will be saved on the Location where we mention , here it is D:\share\vmname.csv
Get-VM |
Select Name,
@{N="Datastore";E={[string]::Join(',',(Get-Datastore -Id $_.DatastoreIdList | Select -ExpandProperty Name))}},
@{N="Folder";E={$_.Folder.Name}} | export-csv D:\share\vmname.csv
No comments:
Post a Comment