Edit

Share via


Get-PSHostProcessInfo

Gets process information about the PowerShell host.

Syntax

ProcessNameParameterSet (Default)

Get-PSHostProcessInfo
    [[-Name] <String[]>]
    [<CommonParameters>]

ProcessParameterSet

Get-PSHostProcessInfo
    [-Process] <Process[]>
    [<CommonParameters>]

ProcessIdParameterSet

Get-PSHostProcessInfo
    [-Id] <Int32[]>
    [<CommonParameters>]

Description

The Get-PSHostProcessInfo cmdlet gets information about PowerShell host processes running on the local computer.

Beginning in PowerShell 6.2, this cmdlet is supported on non-Windows platforms.

Examples

1: Get a list of PowerShell hosts running on the system

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

2: Get PowerShell host information for a specific process name

Get-PSHostProcessInfo -Name pwsh
ProcessName ProcessId AppDomainName
----------- --------- -------------
pwsh            13912 DefaultAppDomain

Parameters

-Id

Specifies a process by the process ID. To get a process ID, run the Get-Process cmdlet.

Parameter properties

Type:

Int32[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ProcessIdParameterSet
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies a process by the process name. To get a process name, run the Get-Process cmdlet.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ProcessNameParameterSet
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Process

Specifies a process by the process object. The simplest way to use this parameter is to save the results of a Get-Process command that returns process that you want to enter in a variable, and then specify the variable as the value of this parameter.

Parameter properties

Type:

Process[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ProcessParameterSet
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Process

You can pipe a Process object from Get-Process to this cmdlet.

Outputs

PSHostProcessInfo