NAME
Get-PSSessionConfiguration
SYNOPSIS
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 cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
“Get-Help about_CommonParameters“.
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.
RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=144304
about_Session_Configurations
Disable-PSSessionConfiguration
Enable-PSSessionConfiguration
Register-PSSessionConfiguration
Set-PSSessionConfiguration
Unregister-PSSessionConfiguration
WS-Management Provider