A
A
Alexander2021-11-13 15:59:41
PowerShell
Alexander, 2021-11-13 15:59:41

How to get a running powershell process?

I'm trying to find out if the 1cv8.exe process is running for the current user through powershell.

GetProcess | Where-Object {($_.SI -eq (Get-Process -PID $PID).SessionId) -and ($_.ProcessName -eq '1cv8')}

But in response, silence, in powershell is not strong =(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MaxKozlov, 2021-11-13
@SmoKE_xD

To get started, simplify to

Get-Process | Where-Object  {$_.ProcessName -eq '1cv8'}

Then to
(Get-Process -PID $PID).SessionId
Make sure you get the output in both cases
The third step
Get-Process | Where-Object  {$_.ProcessName -eq '1cv8'} | select si,sessionid

both should match the output of the second command.
if everything works, your team should also start working.
Although, of course, it is extremely slow and suboptimal, because for each received process it does (Get-Process -PID $PID).SessionId
is better this way
$si = (Get-Process -PID $PID).SessionId; Get-Process | Where-Object {($_.SI -eq $si) -and ($_.ProcessName -eq '1cv8')}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question