Find a process running as root and try to use Get-Process on it when PowerShell was not started w/ sudo, e.g.
Get-Process -Id ((ps -ef | grep ^root | select -first 1 | % { $_ -split ' +' })[1])
The process object is returned
PS /etc> Get-Process -Id ((ps -ef | grep ^root | select -first 1 | % { $_ -split ' +' })[1])
Get-Process : Cannot find a process with the process identifier 1.
At line:1 char:1
+ Get-Process -Id ((ps -ef | grep ^root | select -first 1 | % { $_ -spl ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (1:Int32) [Get-Process], ProcessCommandException
+ FullyQualifiedErrorId : NoProcessFoundForGivenId,Microsoft.PowerShell.Commands.GetProcessCommand
PS /home/jasonsh/src/PowerShell/tools> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-alpha
PSEdition Core
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 3.0.0.0
GitCommitId v6.0.0-alpha.9
CLRVersion
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
I'm considering this a bug as ps 1 works; so obviously this information is available to non-root users.
This seems to be a corefx issue. Filed dotnet/corefx#13135.
Awesome investigation, thanks @nzubair.
This appears to be fixed.
Most helpful comment
This seems to be a corefx issue. Filed dotnet/corefx#13135.