当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 获取 PSHostProcessInfo (Microsoft.PowerShell.Core)

作者:精品下载站 日期:2024-12-14 02:15:52 浏览:14 分类:玩电脑

获取 PSHostProcessInfo (Microsoft.PowerShell.Core)


获取 PSHostProcessInfo

模块 :Microsoft.PowerShell.Core

获取有关 PowerShell 主机的进程信息。

句法

Get-PSHostProcessInfo
   [[-Name] <String[]>]
   [<CommonParameters>]
Get-PSHostProcessInfo
   [-Process] <Process[]>
   [<CommonParameters>]
Get-PSHostProcessInfo
   [-Id] <Int32[]>
   [<CommonParameters>]

描述

Get-PSHostProcessInfo cmdlet 获取有关在本地计算机上运行的 PowerShell 主机进程的信息。

从 PowerShell 6.2 开始,非 Windows 平台支持此 cmdlet。

示例

1:获取系统上运行的PowerShell主机列表

Get-PSHostProcessInfo

ProcessName ProcessId AppDomainName
----------- --------- -------------
powershell      11204 DefaultAppDomain
pwsh            13912 DefaultAppDomain

2:获取特定进程名的PowerShell主机信息

Get-PSHostProcessInfo -Name pwsh

ProcessName ProcessId AppDomainName
----------- --------- -------------
pwsh            13912 DefaultAppDomain

参数

-Id

通过进程 ID 指定进程。要获取进程 ID,请运行 Get-Process cmdlet。

类型 :

Int32[]

位置:

0

默认值:

None

必需的:

True

接受管道输入:

False

接受通配符:

False

-Name

通过进程名称指定进程。要获取进程名称,请运行 Get-Process cmdlet。

类型 :

String[]

位置:

0

默认值:

None

必需的:

False

接受管道输入:

False

接受通配符:

False

-Process

通过进程对象指定进程。使用此参数的最简单方法是将返回要输入的进程的 Get-Process 命令的结果保存在变量中,然后将该变量指定为该参数的值。

类型 :

过程[]

位置:

0

默认值:

None

必需的:

True

接受管道输入:

True

接受通配符:

False

输入

流程

您可以将 Process 对象从 Get-Process 通过管道传输到此 cmdlet。

输出

PSHostProcessInfo

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯