Hi Everyone,
I have a list of powered-off VM's and want to delete to reclaim space,but before that want to check VM's residing on which data store name (e.g. DS_VMAX_Win) and second from the powered-off VM's list with data store name, and powered-off date.3rd, if its possible to find out if the VM's residing on a data store name ( Example - VM's running on VMAX_Oracle) are coming from which storage array. Example VMAX1011 or powremax2025 etc.
thanks
v
Try something like this.
Note1: I used my Get-VIEventPlus function since it should normally be way faster than the Get-VIEvent cmdlet.
The function is attached.
Note2: I don't have access to a vMAX, but afaik queries to such a storage array should be possible through symcli
I did list the LUN CanonicalNames for the datastores
ForEach-Object -Process {
New-Object -TypeName PSObject -Property ([ordered]@{
VM = $_.Name
Datastore = (Get-Datastore -RelatedObject $_).Name -join ' | '
LUN = ((Get-Datastore -RelatedObject $_).ExtensionData.Info.Vmfs.Extent.DiskName |
Sort-Object -Unique) -join ' | '
PoweredOff = Get-VIEventPlus -Entity $_ -EventType 'VmPoweredOffEvent' |
Sort-Object -Property CreatedTime |
Select-Object -Last 1 | Select-Object -ExpandProperty CreatedTime
})
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Do i need the import the module for Eventplus ? using Cli PS D:\vmk> .\Get-VIEventPlus.ps1
thanks
v
That .ps1 file is not a module, just a .ps1 file with a function.
There are 2 options:
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes, i tried using import module command, instead of using . .\Get-VIEventPlus.ps1 but powered-off VM's event not showing. Apart from this im getting the report like VM name,Data store name,LUN NAA ID etc.
thanks
v
It depends when the VM was last powered off.
If that event is older than the maximum retention date for Events on your vCenter, you will not get any events back.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference