VMware Cloud Community
aryan14in
Enthusiast
Enthusiast

OS information of VMs with Tools status

Hi- I am using below script. Need help in modifying below or new script to give me gust OS information as well for each VM along with Tools information.

Get-Cluster -name "clustername" | Get-VM | Get-View | Select-Object @{N="Name";E={$_.Name}},@{Name="ToolsStatus";E={$_.Guest.ToolsStatus}}

Thanks!

Vinod

Reply
0 Kudos
10 Replies
LucD
Leadership
Leadership

Try this

Get-Cluster -name "clustername" | Get-VM | `
Select-Object @{N="Name";E={$_.Name}},     @{Name="ToolsStatus";E={$_.Extensiondata.Guest.ToolsStatus}},     @{N="OS";E={$_.Guest.OSFullName}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
aryan14in
Enthusiast
Enthusiast

Thanks LuCD..

Script worked fine, the only thing is, wherever Tools are installed OS information is populated. Is it possible to get OS information for all VMs with or without tools.

Names                                                                    ToolsStatus                             OS

---------------                                                              -----------------------                        ---------------

server1                                                       toolsNotInstalled
server2                                                        toolsNotInstalled
server3                                                              toolsOk                     Microsoft Windows Server 2003, Standard...
server4                                                             
Reply
0 Kudos
LucD
Leadership
Leadership

You can also display the OS as it was selected during the creation of the guest.

But you can't really rely on what this says.

Btw this value is used to look up certain defaults for the guest.

Get-Cluster -name "clustername" | Get-VM | ` 
Select-Object
@{N="Name";E={$_.Name}},     @{Name="ToolsStatus";E={$_.Extensiondata.Guest.ToolsStatus}},     @{N="OS";E={$_.Guest.OSFullName}},     @{N="OS selected";E={$_.Extensiondata.Config.GuestFullName}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
aryan14in
Enthusiast
Enthusiast

Getting below error when executing the script.

The term ' ' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the nam
e, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scripts\vinod\Get vmware tools status on Cluster with OS.ps1:1 char:46
+ Get-Cluster -name "myclustername" | Get-VM | `  <<<<
    + CategoryInfo          : ObjectNotFound: ( :String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Reply
0 Kudos
LucD
Leadership
Leadership

I suspect there is a blank after the back-tick.

Some editors seem to have problems with that


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
aryan14in
Enthusiast
Enthusiast

can you provide this in a script file please.Thanks!

Reply
0 Kudos
LucD
Leadership
Leadership

Sure


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
aryan14in
Enthusiast
Enthusiast

I just changed the cluster name in script and still getting same error.

Reply
0 Kudos
LucD
Leadership
Leadership

Try this one, I made sure there is no blank at the end of the first line


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
aryan14in
Enthusiast
Enthusiast

cool!! It worked. Thanks! a lot again.

Reply
0 Kudos