VMware Cloud Community
uday1kiran
Contributor
Contributor

How to check whether a process is running on an esx guest windows machine using powercli?

I want to check whether a process is running or not on an esx guest machine using vmware powercli.

How to do that?

Tags (1)
0 Kudos
3 Replies
LucD
Leadership
Leadership

What do you mean with "esx guest machine"?

Is that a VM?

If it is a VM, which guest OS is running in the VM?

You can always use the Invoke-VMScript cmdlet to run a command inside the guest OS (provided VMware Tools are installed).


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

0 Kudos
uday1kiran
Contributor
Contributor

Windows 10 guest machine.

A 64bit 1903 build precisely

Yes, it is a VM.

How to check if a process is running on that VM?

Based on that, I want to frame conditions in my script.

0 Kudos
LucD
Leadership
Leadership

If VMware Tools are installed you can use Invoke-VMscript

$vmName = 'MyVM'

$sInvoke = @{

    VM = $vmName

    ScriptText = 'Get-Process -Name msdtc'

    ScriptType = 'PowerShell'

    GuestCredential = Get-Credential -Message "Credential for $vmName"

}

$result = Invoke-VMScript @sInvoke

$result.ScriptOutput


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

0 Kudos