VMware Cloud Community
antoniogemelli
Hot Shot
Hot Shot

Check VM services

Hello, I would like to have a script to check specific services in a specific VM. Not sure if is possible but maybe there is a way 🙂

Tags (1)
3 Replies
LucD
Leadership
Leadership

The easiest way would be to use Invoke-VMScript and then run a Get-Service inside the guest OS.

The requirement would be that you have VMware Tools installed on those specific VMs.

Is that the case?


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

0 Kudos
antoniogemelli
Hot Shot
Hot Shot

Hi LucD, I bet you will answer first 🙂 yes, VMs have vmtools installed and updated.

0 Kudos
LucD
Leadership
Leadership

Lol

You can do something like this (I just use the WinRM service as an example

$vm = 'MyVM'

$serviceName = 'WinRM'

$code = @"

Get-Service -Name $serviceName

"@

Invoke-VMScript -VM $vm -ScriptType Powershell -ScriptText $code |

Select -ExpandProperty ScriptOutput


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