Hi All
Am trying to find if a process is running in the guest OS. The guest OS is a mixture of Linux, Windows. Is there a way to do it using PowerCLI
You mean something like this?
@sabarirjpm wrote:
Thanks @LucD . Can you help me to add the $vms.Name and the corresponding output of the Get-Process.
$sInvoke = @{
VM = $vms
ScriptText = 'Get-Process -Name <processname> -ErrorAction Ignore'
ScriptType = 'PowerShell'
GuestCredential = $cred
}
Get-VM -PipelineVariable vm |
Where-Object { $_.PowerState -eq 'PoweredOn' -and $_.ExtensionData.Config.GuestFullName -match "Windows" } |
ForEach-Object -Process {
$sInvoke.VM = $vm
$result = Invoke-VMScript @sInvoke
if($result.ScriptOutput.Length -eq 0){
$found = $false
}
else{
$found = $true
}
New-Object PSObject -Property ([ordered]@{
VM = $vm.Name
Found = $found
})
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi.
You can try Invoke-VMScript If it's a certain process.
If your vSphere version and VMware Tools versions are on the correct level, you can use the AppInfo feature.
See William's post Application Discovery in vSphere with VMware Tools 11
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Found few examples and tried the below
Yes, provided the VMware Tools are installed and the credentials are valid in the Guest OS
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks @LucD . Can you help me to add the $vms.Name and the corresponding output of the Get-Process.
You mean something like this?
@sabarirjpm wrote:
Thanks @LucD . Can you help me to add the $vms.Name and the corresponding output of the Get-Process.
$sInvoke = @{
VM = $vms
ScriptText = 'Get-Process -Name <processname> -ErrorAction Ignore'
ScriptType = 'PowerShell'
GuestCredential = $cred
}
Get-VM -PipelineVariable vm |
Where-Object { $_.PowerState -eq 'PoweredOn' -and $_.ExtensionData.Config.GuestFullName -match "Windows" } |
ForEach-Object -Process {
$sInvoke.VM = $vm
$result = Invoke-VMScript @sInvoke
if($result.ScriptOutput.Length -eq 0){
$found = $false
}
else{
$found = $true
}
New-Object PSObject -Property ([ordered]@{
VM = $vm.Name
Found = $found
})
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference