You could start from my Events – Part 8 – VMotion History post.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for your reply..!!
I tried that script, But the output is not the same.
The output comes as attached screen shot "Motion-Capture", But kindly help me out to get the Output as below
Name | Type | SrcHost | DstHost | SrcDatastore | DstDatastore | SrcDC | DstDC | Duration | StartTime | EndTime | Username | ChainID | Server |
Thanks in advance.
Cheers,
Kumar.
The script will provide you with all the events that were created due to a vMotion.
You can extract additional properties from those events.
I don't assume you want me to write your script for you?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
Kindly write the script for me...Please.
Thanks,
Kumar.
Hi Lucd,
Any luck on it ..??
Perhaps you didn't see it as such, but my question was meant to be sarcastic
I don't assume you want me to write your script for you?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Lucd,
Sorry, I never thought it as sarcastic, Since I was new to power cli , So I requested to assist me on the script to make changes as the required output.
Thanks,
Hi Lucd,
Since I'm new to Scripting , Whe I tried running this Cmdlet ..it throws the attached error,kindly assist me how to execute it.
Get-VIEventPlus
Get-MotionHistory.
Using the following
PowerCLI12.1.0 Version
Powershell 5.1 Version.
Any other modules as to installed...Kindly suggest me ..Please
Thanks,
Kumar
You have to copy the two functions in a .ps1 file.
And then call the function, as I showed in my blog post.
To create a .ps1 file, place some content in there and run the script, have a look at for example How to create and run a PowerShell script file on Windows 10
It shows you all the steps you need to take to run a PowerShell script.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That is the same error you posted earlier.
You seem to be calling the function from the PS prompt.
You have to place both functions, together with your call of the function, in a .ps1 file.
And call that .ps1 file.
Or dot-source a .ps1 file containing both functions, before calling the function from the PS prompt.
This is basic PS.
Did you actually read the post I pointed to on how to run PS code?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Lucd,
Thanks for you Advice & Guidance.
When I run the script, Below is the output of it.
VM | Time1 | Host1 | DRS1 |
xcpnhrhr3002 | 26-11-2020 09:20 | xfpnhidsx029 | FALSE |
But few fields are missing in it ,Below is the format for the same, Kindly can help me on it ...Please.
Name | Type | SrcHost | DstHost | SrcDS | DstDS | SrcDC | DstDC | Duration | StartTime | EndTime | Username | ChainID | Server |
xcpfhbmas001 | vMotion | xfpfhidsx035 | xfpfhidsx038 | FH_P_L_CLUESXCSP002P_DTS_015 | FH_P_L_CLUESXCSP002P_DTS_015 | VDC-ServiceProvider | VDC-ServiceProvider | 00:00:49 | 20-07-2020 23:12 | 20-07-2020 23:13 | DRS | 52056668 | wcpnhidvc |
Regards,
Kumar.
Great, you got it working.
Now have a look at my Get The VMotion/SvMotion History post.
That expands on the previous post I linked to.
You'll notice that not all the information you want to see is available for all events.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Lucd,
So you want me to combine both scripts & Run it or Kindly advice me how to proceed ..Please assist me.
Thanks in advance.
Regards,
Kumar
No, those are new functions, they are built on the same concept as the previous one.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Lucd,
I copied "Get the vMotion/svMotion history" in a different PS1, Tried executing it …But I didn't get any output. Kindly advice me if anything as to be modified on the script.
Below is the few lines I added on the top of the Script (i.e. .Get the vMotion/svMotion history)
$hours = 24 # Number of hours back
$start = (Get-Date).AddHours(-$hours)
$tasknumber = 999 # Windowsize for task collector
$eventnumber = 100 # Windowsize for event collector
$tgtTaskDescriptions = "VirtualMachine.migrate","Drm.ExecuteVMotionLRO"
$migrations = @()
$report = @()
# Get the guest for which we want the report
$vmHash = @{}
Get-Datacenter -Name "VDC-ServiceProvider" | Get-VM | %{
$vmHash[$_.Name] = $_.Host
}
Thanks in advance
Regards,
Kumar
And where are you calling the function?
There is a sample call in that blog post.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Lucd,
I'm trying to call in the beginning of the script, If it's wrong..!! Kindly help where exactly it should be called...Please ..Since this script is very urgent & important.
If don't mind ..Kindly write it for me this time....Please.
It's an request ….!!
Regards,
Kumar.
Hi Lucd,
It's working, But I required "ChainID" also, How can I include the same into the script...Please
Below is the OUTPUT,
"CreatedTime","Type","UserName","VM","SrcVMHost","TgtVMHost","SrcDatastore","TgtDatastore"
Regards,
Kumar.