Skip to content

Files

Latest commit

12b52c9 · Mar 26, 2025

History

History
86 lines (57 loc) · 1.87 KB

Get-PSSessionInfo.md

File metadata and controls

86 lines (57 loc) · 1.87 KB
external help file Module Name online version schema
PSScriptTools-help.xml
PSScriptTools
2.0.0

Get-PSSessionInfo

SYNOPSIS

Get details about the current PowerShell session.

SYNTAX

Get-PSSessionInfo [<CommonParameters>]

DESCRIPTION

This command will provide a snapshot of the current PowerShell session. The Runtime and Memory properties are defined by script so if you save the result to a variable, you will get current values every time you look at the variable.

EXAMPLES

Example 1

PS C:\> Get-PSSessionInfo

ProcessID   : 1112
Command     : "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile
Host        : ConsoleHost
Started     : 4/9/2024 9:36:13 AM
PSVersion   : 7.1.3
Elevated    : True
Parent      : System.Diagnostics.Process (WindowsTerminal)
Runtime     : 00:31:26.2716486
MemoryMB    : 129

The Memory value is in MB. If running in a PowerShell console session, the Elevated value will be displayed in color.

Example 2

PS /home> Get-PSSessionInfo

ProcessID   : 71
Command     : pwsh
Host        : ConsoleHost
Started     : 04/09/2024 09:38:55
PSVersion   : 7.1.3
Elevated    : False
Parent      : System.Diagnostics.Process (bash)
Runtime     : 00:30:07.1669248
MemoryMB    : 133

The result from a Linux host.

PARAMETERS

CommonParameters

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

INPUTS

None

OUTPUTS

PSSessionInfo

NOTES

This command has an alias of gsin.

Learn more about PowerShell: https://jdhitsolutions.com/yourls/newsletter

RELATED LINKS

Get-Host

Get-Process