Hi,
I've been watching Luc and Alan's PowerCLI Best Practice: The Return session from VMWorld 2012.
I was trying out some of the examples on my environment to see what the results were.
Get-VM | Select Name, @{Name="BootTime";Expression={$_.ExtensionData.Summary.RunTime.BootTime.ToLocalTime()}}
Name BootTime
---- --------
Analytics VM 30/09/12 3:07:57 AM
UI VM 30/09/12 3:09:29 AM
server1
server2
server3
server4
server5
server6
server7 08/10/12 4:45:42 PM
I get a bunch more results, but some come back with the BootTime data and some don't.
I've got the following VMware snapins for Powershell installed.
PowerCLI C:\SVN_Checkout\Scripts_Powershell> Get-PowerCLIVersion
PowerCLI Version
----------------
VMware vSphere PowerCLI 5.0.1 build 581491
---------------
Snapin Versions
---------------
VMware AutoDeploy PowerCLI Component 5.0 build 544967
VMware ImageBuilder PowerCLI Component 5.0 build 544967
VMware License PowerCLI Component 5.0 build 544881
VMware vSphere PowerCLI Component 5.0 build 581435
VMware vCenter Update Manager PowerCLI 4.1 build 266648
My question is: Why am I only getting BootTime for some of the virtual servers? I know that have been booted as some of them are online right now.
Thanks,
David
Thansk for attending our session.
The explanation might be in the description of the Boottime property in VirtualMachineRuntimeInfo object.
A powered off VM doesn't have a value in this property.
Would that explain what you are seeing ?
Perhaps add the powerstate property to your output.
Get-VM | Select Name, @{Name="BootTime";Expression={$_.ExtensionData.Summary.RunTime.BootTime.ToLocalTime()}},
PowerState
Update: I have to admit I also see empty Boottime values for several VMs. This phenomena has been reported before, but there was no real explanation I'm afraid.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
Below is the result when I add in the PowerState property.
PowerCLI C:\SVN_Checkout\Scripts_Powershell> Get-VM |
>> Select Name,
>> @{Name="BootTime";Expression={$_.ExtensionData.Summary.RunTime.BootTime.ToLocalTime()}}, PowerState
>>
Name BootTime PowerState
---- -------- ----------
Analytics VM 30/09/12 3:07:57 AM PoweredOn
UI VM 30/09/12 3:09:29 AM PoweredOn
server1 PoweredOn
server2 PoweredOn
server3 PoweredOn
server4 PoweredOn
server5 PoweredOn
server6 PoweredOn
server7 08/10/12 4:45:42 PM PoweredOn
server8 30/03/12 8:55:28 PM PoweredOn
server9 21/07/12 4:30:45 PM PoweredOn
server10 PoweredOn
server11 PoweredOn
server12 10/09/12 8:16:18 AM PoweredOn
server13 15/10/12 9:45:22 AM PoweredOff
server14 15/10/12 9:45:43 AM PoweredOff
NOTE: I have changed the server names in the output to be genertic and not what they are called within vCentre.
The two virtual machines that are listed as PoweredOff are both off when viewed in the vSphere Client. They have been powered on before.
Any further ideas?
See my update on my previous reply.
There seem indeed to be problems with that property.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
Thanks for helping out with a response to the question. Would be nice if I could know the cause, but I'll investigate further when I have a better understanding of Powershell and PowerCLI.
Thanks again.
David
Hi,
With PowerCLI 5.8 Release 1 this property field .ExtensionData.Summery.RunTime.BootTime is still empty with some VM's. So this bug hasn't been solved yet?
Kind regards,
Bastiaan van Haastrecht
Afaik this is not a PowerCLI bug (remember the ExtensionData maps to a read-only copy of the actual vSphere object).
This is an ESXi issue in my opinion.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD
First of all, thanks for your support.
I have faced same issue, could you please take a look at it:
when I try on other computers it works (same configuration).
Thanks in advance for your help.
Are you connected to a vCenter or an ESXi node?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LicD
Yes.
Yes, what?
Is it a vCenter or an ESXi node?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes, I have already connected to the Vcenter, and host.
When you connect to the ESXi node, that info is not available.
Only use the vCenter connection.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD
just for clear my question:
Connect-VIServer -Server xxxxx
$h = get-vmhost xxxxxxx
$global:DefaultVIServers | fl
$h
With Connect-VIServer you can connect to a vCenter or an ESXi node.
Your code doesn't tell my anything
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
let me past more:
Connect-VIServer -Server yyyyyyy
$h = get-vmhost xxxxxxx
$global:DefaultVIServers
$h | fl
Do you actually read my text?
None of your replies answers anything I asked.
Have you worked with PowerCLI and/or PowerShell before?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD.
I got my answer.
again Thank you so much for your answer.
I wish the best.
