We have different teams managing the VM's in the infrastructure. I want to know how to get the details of the VM movement in the VM & templates view of VI client through PowerCLI, report should look something like below.
VMname
From_Folder
To_Folder
Date_Time
UserName
Afaik that information is only partialy available in the vCenter Task and Events log.
See also the Task and Events tab in the vSphere Client.
You can get the timestamp, the user and the destination, but the other info is not present
Get-VIEvent -MaxSamples 500 | where {$_.GetType().Name -eq "TaskEvent" -and $_.Info.Name -eq "MoveIntoFolder_Task"} | select CreatedTime,UserName,@{N="Destination";E={$_.Info.EntityName}}
You can change the MaxSamples value if you want to go back further in time.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Afaik that information is only partialy available in the vCenter Task and Events log.
See also the Task and Events tab in the vSphere Client.
You can get the timestamp, the user and the destination, but the other info is not present
Get-VIEvent -MaxSamples 500 | where {$_.GetType().Name -eq "TaskEvent" -and $_.Info.Name -eq "MoveIntoFolder_Task"} | select CreatedTime,UserName,@{N="Destination";E={$_.Info.EntityName}}
You can change the MaxSamples value if you want to go back further in time.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference