Hi all,
I have been tasked to gather info about all our Windows machines running in vSphere. Basically the most important thing is to find out the version of Windows we are running, e.g., Windows Server 2008 R2 Enterprise.
I have attempted several times to run a script to scan host/vcentre to retrieve the info; however the furthest I can get is to get the info from vmtools which does not retrieve the actual version of windows running. I have seen this community thread, but still does not tell me whether Standard or Enterprise is running.
What is the way of querying the guestOS to retrieve the version?
PS: I am fine running a powershell script to query AD to get the Windows version; however we have quite a few Windows VMs which are not joined to any domain, hence my limitations scanning AD via powershell and the need to query vCentre.
Help is much appreciated
rb51
Hello,
Pitty it is, Vmware not gathering that 100% . Because for them it makes no differences.
so best would be to gather this inside OS going other through the AD with Powershell.
(gwmi win32_operatingsystem).caption
That gives me back for example : Microsoft Windows Server 2012 Datacenter
Best regards
Max
Like MadMax01 suggests, run that powershell command via powercli.
I assume you got a list of vms with windows systems:
$WindowsVMS = get-view -viewtype virtualmachine -property 'name','guest.guestFamily' -filter @{'guest.GuestFamily'='windowsGuest'}
Then you invoke script on them . Assuming that in those boxes vmware tools are running of course.
Build a windows credential set before:
$credential = get-credential
foreach ($vm in $WindowsVMS){
$vm | select name, @{n='Edition';e={(Invoke-VMScript -GuestCredential $credential -ScriptType 'powershell' -ScriptText '(gwmi win32_operatingsystem).caption' -VM $vm.name).ScriptOutput} }
}
At the end you willl get nice report like
Name Edition
---- -------
myVM Microsoft Windows Server 2008 R2 Enterprise ...
Assuming that those credentials will match every vm it should be all ok. If not you have to try to run multiple times this script with different versions, and try implementing ifs on fault then use different set of credential.
thank you both,
I will try the suggestion and check the outcome.
thanks again for taking the time to reply to my post.
rb51