I want to check whether a process is running or not on an esx guest machine using vmware powercli.
How to do that?
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
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.
If VMware Tools are installed you can use Invoke-VMscript
$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