Hello, I am using PowerCli to find the vm os summary info. I could successfully get the VM's os name by running the command
Get-VM | Sort | Get-View -Property @("Name", "Config.GuestFullName", "Guest.GuestFullName") | Select -Property Name, @{N="Configured OS";E={$_.Config.GuestFullName}}, @{N="Running OS";E={$_.Guest.GuestFullName}} | Format-Table -AutoSize
It give me the OS name like
Red Hat Enterprise Linux 5 (64-bit)
and I need the kernel version too like
Linux <HOST-NAME> 2.6.32-642.6.2.el6.x86_64 #1 SMP Mon Oct 24 10:22:33 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux
Is there any way to get it through PowerCli or vsphere api? Please let me know.
Thanks,
Senthil
Since the VM has VMware Tools installed, you can use the Invoke-VMScript cmdlet to run a bash script or a command inside the guest OS.
The output of the script/command is returned to your script.
From the expected output it looks as if running 'uname -a' should be the command you will need to run inside the guest OS.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for the quick reply. We do have a home grown script that do much like invoke-scripts and planning to use that.