Export (0) Print
Expand All

Get-PSSessionConfiguration

Updated: April 21, 2010

Applies To: Windows PowerShell 2.0

Gets the registered session configurations on the computer.

Syntax

Get-PSSessionConfiguration [[-Name] <string[]>] [<CommonParameters>]

Description

The Get-PSSessionConfiguration cmdlet gets the session configurations that have been registered on the local computer. This is an advanced cmdlet that is designed to be used by system administrators to manage customized session configurations for their users.

To create and register a session configuration, use the Register-PSSessionConfiguration cmdlet.

Parameters

-Name <string[]>

Gets only the session configurations with the specified name or name pattern. Enter one or more session configuration names. Wildcards are permitted.

 

Required?

false

Position?

1

Default Value

All session configurations on the local computer

Accept Pipeline Input?

false

Accept Wildcard Characters?

true

<CommonParameters>

This command supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, OutBuffer, OutVariable, WarningAction, and WarningVariable. For more information, see about_CommonParameters.

Inputs and Outputs

The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns.

 

Inputs

None

You cannot pipe input to this cmdlet.

Outputs

Microsoft.PowerShell.Commands.PSSessionConfigurationCommands#PSSessionConfiguration

Notes

To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows, you must open Windows PowerShell with the "Run as administrator" option.

To view the session configurations on the computer, you must be a member of the Administrators group on the computer.

To run a Get-PSSessionConfiguration command on a remote computer, Credential Security Service Provider (CredSSP) authentication must be enabled in the client settings on the local computer (by using the Enable-WSManCredSSP cmdlet) and in the service settings on the remote computer, and you must use the CredSSP value of the Authentication parameter when establishing the remote session. Otherwise, access is denied.

Example 1

C:\PS>get-pssessionconfiguration

Description
-----------
This command gets the session configurations on the computer.







Example 2

C:\PS>get-pssessionconfiguration -name Microsoft*

Name                      PSVersion  StartupScript        Permission
----                      ---------  -------------        ----------
microsoft.powershell      2.0                             BUILTIN\Administrators AccessAll...
microsoft.powershell32    2.0                             BUILTIN\Administrators AccessAll...

Description
-----------
This command uses the Name parameter of Get-PSSessionConfiguration to get only the session configurations with names that begin with "Microsoft".

This command gets the two default session configurations that come with Windows PowerShell.







Example 3

C:\PS>Get-PSSessionConfiguration -name microsoft.powershell | get-member



   TypeName: Microsoft.PowerShell.Commands.PSSessionConfigurationCommands#PSSessionConfiguration

Name                   MemberType     Definition
----                   ----------     ----------
Equals                 Method         bool Equals(System.Object obj)
GetHashCode            Method         int GetHashCode()
GetType                Method         type GetType()
ToString               Method         string ToString()
Capability             NoteProperty   System.Object[] Capability=System.Object[]
ExactMatch             NoteProperty   System.String ExactMatch=False
Filename               NoteProperty   System.String Filename=%windir%\system32\pwrshplugin.dll
lang                   NoteProperty   System.String lang=en-US
Name                   NoteProperty   System.String Name=microsoft.powershell
PSVersion              NoteProperty   System.String PSVersion=2.0
ResourceUri            NoteProperty   System.String ResourceUri=http://schemas.microsoft.com/powershell/microsoft.powershell
SDKVersion             NoteProperty   System.String SDKVersion=1
SecurityDescriptorSddl NoteProperty   System.String SecurityDescriptorSddl=O:NSG:BAD:P(A;;GA;;;BA)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
SupportsOptions        NoteProperty   System.String SupportsOptions=true
Uri                    NoteProperty   System.String Uri=http://schemas.microsoft.com/powershell/microsoft.powershell
xmlns                  NoteProperty   System.String xmlns=http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration
XmlRenderingType       NoteProperty   System.String XmlRenderingType=text
Permission             ScriptProperty System.Object Permission {get=trap { continue; }...


C:\PS> Get-PSSessionConfiguration -name microsoft.powershell | format-list -property *


Name                   : microsoft.powershell
Filename               : %windir%\system32\pwrshplugin.dll
SDKVersion             : 1
XmlRenderingType       : text
lang                   : en-US
PSVersion              : 2.0
ResourceUri            : http://schemas.microsoft.com/powershell/microsoft.powershell
SupportsOptions        : true
Capability             : {Shell}
Uri                    : http://schemas.microsoft.com/powershell/microsoft.powershell
SecurityDescriptorSddl : O:NSG:BAD:P(A;;GA;;;BA)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
ExactMatch             : False
xmlns                  : http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration
Permission             : BUILTIN\Administrators AccessAllowed

Description
-----------
These commands examine the PSSessionConfiguration object that Get-PSSessionConfiguration returns.

The first command uses the Get-PSSessionConfiguration cmdlet to get the Microsoft.PowerShell default configuration.

The second command uses a pipeline operator (|) to send the object that Get-PSSessionConfiguration returns to the Get-Member cmdlet. The output shows the properties and methods of the object.

The third command sends the same object to the Format-List cmdlet. The Property parameter with a value of * (all) directs Format-List to display all of the properties and property values of the object in a list.

The output of this command has very useful information, including the location of the .dll that implements the configuration type, the resource Uniform Resource Identifier (URI) for the endpoint that is created, and the Security Descriptor Definition Language (SDDL) for the configuration.







Example 4

C:\PS>dir wsman:\localhost\plugin

   WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Plugin

Name                      Type                 Keys
----                      ----                 ----
Event Forwarding Plugin   Container            {Name=Event Forwarding Plugin}
MaintenanceShell          Container            {Name=MaintenanceShell}
microsoft.powershell      Container            {Name=microsoft.powershell}
microsoft.powershell32    Container            {Name=microsoft.powershell32}
WMI Provider              Container            {Name=WMI Provider}

Description
-----------
This command uses the Get-ChildItem cmdlet (alias = dir) in the WSMan: provider drive to look at the content of the Plugin node.

This is another way to look at the session configurations on the computer.

The PlugIn node contains ContainerElement objects (Microsoft.WSMan.Management.WSManConfigContainerElement) that represent the registered Windows PowerShell session configurations, along with other plug-ins for WS-Management.







Example 5

C:\PS>enable-wsmanCredSSP -delegate server02

C:\PS> connect-wsman server02

C:\PS> set-item wsman:\server02*\service\auth\credSSP -value $true

C:\PS> invoke-command -scriptblock {Get-PSSessionConfiguration} -computername Server02 -authentication CredSSP -credential Domain01\Admin01 

Name                      PSVersion  StartupScript        Permission                          PSComputerName
----                      ---------  -------------        ----------                          --------------
microsoft.powershell      2.0                             BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com
microsoft.powershell32    2.0                             BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com
MyX86Shell                2.0        c:\test\x86Shell.ps1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com

Description
-----------
This example shows how to run a Get-PSSessionConfiguration command on a remote computer. The command requires that CredSSP delegation be enabled in the client settings on the local computer and in the service settings on the remote computer. To run the commands in this example, you must be a member of the Administrators group on the local computer and the remote computer.

The first command uses the Enable-WSManCredSSP cmdlet to enable CredSSP delegation from the Server01 local computer to the Server02 remote computer. This configures the CredSSP client setting on the local computer.

The second command uses the Connect-WSMan cmdlet to connect to the Server02 computer. This action adds a node for the Server02 computer to the WSMan: drive on the local computer, allowing you to view and change the WS-Management settings on the Server02 computer.

The third command uses the Set-Item cmdlet to change the value of the CredSSP item in the Service node of the Server02 computer to True. This configures the service settings on the remote computer.

The fourth command uses the Invoke-Command cmdlet to run a Get-PSSessionConfiguration command on the Server02 computer. The command uses the Credential parameter, and it uses the Authentication parameter with a value of CredSSP.







Example 6

C:\PS>(get-PSSessionConfiguration -name CustomShell).resourceURI

http://schemas.microsoft.com/powershell/microsoft.CustomShell

Description
-----------
This command uses the Get-PSSessionConfiguration cmdlet to get the resource URI of a session configuration. 

This command is useful when setting the value of the $PSSessionConfigurationName preference variable, which takes a resource URI. 

The $PSSessionConfiguationName variable specifies the default configuration that is used when you create a session. This variable is set on the local computer, but it specifies a configuration on the remote computer. For more information about the $PSSessionConfiguration variable, see about_Preference_Variables.







See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft