[英]Get the process ID of a remote powershell session
Remote powershell sessions (PSSessions) have corresponding wsmprovhost processes. 远程Powershell会话(PSSession)具有相应的wsmprovhost进程。 How do I get the process ID corresponding to a PSSession?
如何获取与PSSession相对应的进程ID? I tried running get-member on a list of powershell sessions and here's a part of what I got:
我尝试在Powershell会话列表上运行get-member,这是我得到的一部分:
Name MemberType
---- ----------
Equals Method
GetHashCode Method
GetType Method
ToString Method
ApplicationPrivateData Property
Availability Property
ComputerName Property
ConfigurationName Property
Id Property
InstanceId Property
Name Property
Runspace Property
IdleTimeout ScriptProperty
OutputBufferingMode ScriptProperty
State ScriptProperty
You can use $PID
in the script block. 您可以在脚本块中使用
$PID
。
PS C:\> $pssession = New-PSSession -ComputerName Demo-1
PS C:\> Invoke-Command -Session $pssession -ScriptBlock { $PID }
1888
PS C:\>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.