New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wait-Process -InputObject $P where $P= Start-Process with credentials, Passtru and no -Wait results is Access Denied #19410
Comments
|
This is essentially a duplicate of #19411 (comment) |
|
I do not agree that it is a duplicate. Perhaps the background reason is the same .Net issue but it are completely different powershell issues. |
|
It is, the process object you get back from
Using The ultimately fix is to stop doing the work manually in |
|
Ok I understand that during start-process the solution could be different (because of the internal available token), But why does $p.WaitForExit be different then Wait-Process while they both only wait for the process itself (while start-process -Wait should/will wait for the full process-tree (also started child processes!) |
|
The process object you get back from Start-Process pwsh.exe -Credential $cred
$proc = Get-Process -Name pwsh
$proc.WaitForExit()Windows does give the creator of the new process a handle to that process with full access to do whatever they want but the way PowerShell starts it and how dotnet works it is unable to embed that token in the |


Prerequisites
Steps to reproduce
#I can not use Wait-Process to wait for a process started with Start-Process -PassTru -Credials $credential (other user)
$Script_Str ='D:_DATA_PUBLIC_DATA_f_shared_batch_scripts\Slideshow_runAndWait_sub2.ps1'
$Process1 =Start-Process pwsh.exe -PassThru -credential $Credentials -ArgumentList "-file $Script_Str"
wait-Process -InputObject $Process1
Expected behavior
The applet Wait-Process should continue as soon as the started process has endedActual behavior
I get Access Denied and also timeout messageError details
Environment data
Visuals
remarks: in powershell 7.4 preview 2 the same kind of problem was solved which involved
$p =Start-Process -PassTru -Credentials and -Wat.
That works now but Wait-Process -InputObject -$p does still not work.
($p.waitforExit however was already working in powershell 5 en 7)
The text was updated successfully, but these errors were encountered: