I want to open some brave profiles and close them later. So I want to save process id's on a file and iterate them to close it. But Id returned from Start-Process is not a real Id and I can't find that process later.
I checked on command prompt and found this:
$process = Start-Process $bravePath -ArgumentList "--profile-directory=""$profile""" -PassThru
$process.Id
will give me 3060
. But if I run this: Get-Process -Id 3060
, I get this error:
Get-Process : Not found process with identifier 3060.
I checked this Answer: https://stackoverflow.com/a/12084492/4599564 and it looks like brave is creating a new sub process on the collection of already existent brave process and closing the new one.
Is there any method to get the Id of the created brave process so I can stop it later?
stop-process -name brave