Tutorials  PowerShell Cmdlet Help for Get-PSSessionConfiguration


Gets the registered session configurations on the computer.

Get-PSSessionConfiguration [[-Name] ] []

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

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

Gets only the session configurations with the specified name or name pattern. Enter one or more session configu
ration 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

This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

You cannot pipe input to this cmdlet.



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 com

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 Authenti
cation parameter when establishing the remote session. Otherwise, access is denied.

-------------------------- EXAMPLE 1 --------------------------


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...

This command uses the Name parameter of Get-PSSessionConfiguration to get only the session configurations with name
s 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.p
SDKVersion NoteProperty System.String SDKVersion=1
SecurityDescriptorSddl NoteProperty System.String SecurityDescriptorSddl=O:NSG:BAD:P(A;;GA;;;BA)S:P(AU;FA;GA;;;WD
SupportsOptions NoteProperty System.String SupportsOptions=true
Uri NoteProperty System.String Uri=http://schemas.microsoft.com/powershell/microsoft.powershel
xmlns NoteProperty System.String xmlns=http://schemas.microsoft.com/wbem/wsman/1/config/PluginCo
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

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 G
et-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) d
irects 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 conf
iguration type, the resource Uniform Resource Identifier (URI) for the endpoint that is created, and the Security D
escriptor 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}

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 rep
resent 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 -cre
dential Domain01\Admin01

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

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 remot
e computer. To run the commands in this example, you must be a member of the Administrators group on the local comp
uter 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 t
he Server02 computer to the WSMan: drive on the local computer, allowing you to view and change the WS-Management s
ettings 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 Serve
r02 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 compu
ter. 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


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 info
rmation about the $PSSessionConfiguration variable, see about_Preference_Variables.

Online version: http://go.microsoft.com/fwlink/?LinkID=144304
WS-Management Provider