Guv
Enthusiast
Enthusiast

Help with 2 simple scripts

Jump to solution

I am looking for 2 very simple scripts, one is for a specific cluster 1, i want to list all VM's which have 4gb of memory or more.

Then a 2nd script for a specific cluster1, want to list VM's which dont have VM tools installed or are out of date and want to select the name, vmware tool status and the the memory.

Can anyone assist please

0 Kudos
1 Solution

Accepted Solutions
jonathanp
Expert
Expert

here is a one line that I tried on a single host...and should work if you log on a VC as well... it will list all the VMs that have more than 4GB of memory :

Get-VM | Where-Object {$_.MemoryMB -gt 4096}

If you want just the name and memory then :

Get-VM | Where-Object {$_.MemoryMB -gt 4096} | Select Name,MemoryMB

For the other for the VMtools...

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

Regards

View solution in original post

0 Kudos
3 Replies
jonathanp
Expert
Expert

Is that for ESX or ESXi?

Are you looking for a powershell script or a shell script?

Jonathan

0 Kudos
Guv
Enthusiast
Enthusiast

powershell script.

thanks

0 Kudos
jonathanp
Expert
Expert

here is a one line that I tried on a single host...and should work if you log on a VC as well... it will list all the VMs that have more than 4GB of memory :

Get-VM | Where-Object {$_.MemoryMB -gt 4096}

If you want just the name and memory then :

Get-VM | Where-Object {$_.MemoryMB -gt 4096} | Select Name,MemoryMB

For the other for the VMtools...

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

Regards

0 Kudos