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 🙂
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
Hi LucD, I bet you will answer first 🙂 yes, VMs have vmtools installed and updated.
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