Step 1:
Connect
to the vCenter Server using PowerCLI
Step 2:
Create a script file to export the
snapshots in csv format.
Open notepad à copy and paste the
text below à
save as snapshot.ps1 in C:\
$VMinfo = foreach ($datastore in
(Get-DatastoreCluster DatastoreClusterName | Sort -Property Name)){
foreach ($VM in ($datastore | get-vm |
sort-object -property Name)) {
foreach ($Harddisk in ($VM | get-harddisk |
sort-object -property Name)){
foreach ($VirtualPortGroup in ( $VM |
get-virtualportgroup | sort-object -property Name)){
""|select -property
@{N="vm";E={$vm.Name}},
@{N="HardDisk";E={$HardDisk.Name}},
@{N="Datastore";E={$HardDisk.FileName.Split("]")[0].TrimStart("]")}},
@{N="VMDKPath";E={$HardDisk.FileName}},
@{N="CapacityGB";E={$HardDisk.CapacityGB}},
@{N="PortGroup";E={$VirtualPortGroup.Name}}
@{N="CPU";E={$VM.NumCpu}},
@{N="MemoryGB";E={$VM.MemoryGB}}
}
}
}
}
$VMinfo |Export-csv -notypeinformation
-useculture -path "C:\vminfo.csv"
Step 3:
Now run a script file to export the
snapshots in csv format
>
Set-Location C:\
>
.\VM-info.ps1
Note: To get the report at Datacenter level,
Get-DataCenter DataCenterName
Note: To get the report at Datacenter level,
Get-DataCenter DataCenterName
No comments:
Post a Comment