Hello I'm desperately trying to find a script/way of reporting on past DRS and vMotion moves ?
I have tried a couple without success !
Have you looked at LucD's functions for getting vMotion and svMotion events? It's probably a good place to start anyways. Here's the link:
Get the vMotion/svMotion history | LucD notesLucD notes
Yes i tried this but I didn't manage to get this to work. Can you explain what I'm doing wrong. This is what i did.
Copied the first part the script from line 1 to line 101 and named this Get-VIEventPlus.ps1
Next I copied line 103 to 187 and named this Get-MotionHistory.ps1
? So is this correct
When I run vcluster being the name of the cluster.
PowerCLI C:\> Get-Cluster -Name vCluster | Get-MotionHistory -Hours 4 -Recurse:$truecls
I get this ?
The term 'Get-MotionHistory' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:47
+ Get-Cluster -Name vCluster | Get-MotionHistory <<<< -Hours 4 -Recurse:$truecls
+ CategoryInfo : ObjectNotFound: (Get-MotionHistory:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command Get-MotionHistory was not found, but does exist in the current location. Windows PowerShell doesn't
load commands from the current location by default. If you trust this command, instead type ".\Get-MotionHistory". See "get-help about
_Command_Precedence" for more details.
PowerCLI C:\>
So you have the 2 functions in separate .ps1 files, good.
But you will now have to dot-source these files, so the PowerShell engine "knows" these functions.
You do that as follows:
. ./Get-VIEventPlus.ps1
. ./Get-MotionHistory.ps1
Once doen, you can call the functions like you did.
Note: there is a blank between the 2 dots !
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Many thanks for your help! I'll report back tomorrow.
Kind regards,
Re-tried the scripts now working thankyou against our current 5.1 vcentre. I have a another question that you might be able to answer. I have restored an older SQL DB that was for our existing 4.1 vcenter. I'm now trying to retrieve past migrations from this old instance. But when I am running the script get-vmotionhistory it's returning nothing ? Is it that the information is no longer available.
The vcenter is displays the cluster and host information, although these hosts have now been migrated & upgrade to 5.1 and are registered to another vcenter.
That is most probably because the MoRef, the internal identifier of a VM, has changed due to the vCenter restore.
The statiscal data will have to old MoRef, while the VMs will have a new MoRef.
William wrote a post on that, see When Do vSphere MoRef's Change?
See his "Additional scenarios" at the bottom of the post.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
