PowerShell Logo Small

Set-PSSessionConfiguration



This is the built-in help made by Microsoft for the command 'Set-PSSessionConfiguration', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Changes the properties of a registered session configuration.

SYNTAX


Set-PSSessionConfiguration [-Name] <String> [-AccessMode <PSSessionConfigurationAccessMode>] [-ApplicationBase <String>] [-Force]
[-MaximumReceivedDataSizePerCommandMB <Double>] [-MaximumReceivedObjectSizeMB <Double>] [-ModulesToImport <String[]>] [-NoServiceRestart]
[-PSVersion <Version>] [-RunAsCredential <PSCredential>] [-SecurityDescriptorSddl <String>] [-SessionTypeOption <PSSessionTypeOption>]
[-ShowSecurityDescriptorUI] [-StartupScript <String>] [-ThreadApartmentState <ApartmentState>] [-ThreadOptions <PSThreadOptions>]
[-TransportOption <PSTransportOption>] [-UseSharedProcess] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-PSSessionConfiguration [-Name] <String> [-AssemblyName] <String> [-ConfigurationTypeName] <String> [-AccessMode
<PSSessionConfigurationAccessMode>] [-ApplicationBase <String>] [-Force] [-MaximumReceivedDataSizePerCommandMB <Double>]
[-MaximumReceivedObjectSizeMB <Double>] [-ModulesToImport <String[]>] [-NoServiceRestart] [-PSVersion <Version>] [-RunAsCredential
<PSCredential>] [-SecurityDescriptorSddl <String>] [-SessionTypeOption <PSSessionTypeOption>] [-ShowSecurityDescriptorUI] [-StartupScript
<String>] [-ThreadApartmentState <ApartmentState>] [-ThreadOptions <PSThreadOptions>] [-TransportOption <PSTransportOption>]
[-UseSharedProcess] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-PSSessionConfiguration [-Name] <String> [-AccessMode <PSSessionConfigurationAccessMode>] [-Force] [-MaximumReceivedDataSizePerCommandMB
<Double>] [-MaximumReceivedObjectSizeMB <Double>] [-NoServiceRestart] [-RunAsCredential <PSCredential>] [-SecurityDescriptorSddl <String>]
[-ShowSecurityDescriptorUI] [-StartupScript <String>] [-ThreadApartmentState <ApartmentState>] [-ThreadOptions <PSThreadOptions>]
[-TransportOption <PSTransportOption>] [-UseSharedProcess] -Path <String> [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Set-PSSessionConfiguration cmdlet changes the properties of the session configurations on the local computer.


Use the Name parameter to identify the session configuration that you want to change. Use the other parameters to specify new values for the
properties of the session configuration. To delete a property value from the configuration (and use the default value), enter an empty string
("") or a value of $null for the corresponding parameter.


Beginning in Windows PowerShell 3.0, you can use a session configuration file to define a session configuration. This feature provides a
simple and discoverable method for setting and changing the properties of sessions that use the session configuration. To specify a session
configuration file, use the Path parameter of Set-PSSessionConfiguration. For information about session configuration files, see
about_Session_Configuration_Files (http://go.microsoft.com/fwlink/?LinkID=236023). For information about creating and editing a session
configuration file, see New-PSSessionConfigurationFile.


Session configurations define the environment of remote sessions (PSSessions) that connect to the local computer. Every PSSession uses a
session configuration. The session configuration determines the features of the PSSession, such as the modules that are available in the
session, the cmdlets that are permitted to run, the language mode, quotas, and timeouts. The security descriptor (SDDL) of the session
configuration determines who can use the session configuration to connect to the local computer. For more information about session
configurations, see about_Session_Configurations.


To see the properties of a session configuration, use the Get-PSSessionConfiguration cmdlet or the WSMan Provider. For more information about
the WSMan Provider, type "Get-Help WSMan".



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkID=144307
Disable-PSSessionConfiguration
Enable-PSSessionConfiguration
Get-PSSessionConfiguration
New-PSSessionConfigurationFile
New-PSSessionOption
New-PSTransportOption
New-PSWorkflowExecutionOption
Register-PSSessionConfiguration
Set-PSSessionConfiguration
Test-PSSessionConfigurationFile
Unregister-PSSessionConfiguration
WSMan Provider
about_Session_Configurations
about_Session_Configuration_Files

REMARKS

<

Examples


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

PS C:\>Set-PSSessionConfiguration -Name MaintenanceShell -ThreadApartmentState STA



This command changes the thread apartment state in the MaintenanceShell configuration to STA. The change is effective when you restart the
WinRM service.








-------------------------- EXAMPLE 2 --------------------------

The first command uses the Register-PSSessionConfiguration cmdlet to create the AdminShell configuration.
PS C:\>Register-PSSessionConfiguration -name AdminShell -AssemblyName C:\Shells\AdminShell.dll -ConfigurationType AdminClass

The second command uses the Set-PSSessionConfiguration cmdlet to add the AdminConfig.ps1 script to the configuration. The change is effective
when you restart WinRM.
PS C:\>Set-PSSessionConfiguration -Name AdminShell -StartupScript AdminConfig.ps1

The third command removes the AdminConfig.ps1 script from the configuration. It uses the Set-PSSessionConfiguration cmdlet with a value of
$null for the StartupScript parameter.
PS C:\>Set-PSSessionConfiguration -Name AdminShell -StartupScript $null



This example shows how to create and then change a session configuration.




-------------------------- EXAMPLE 3 --------------------------

PS C:\>Set-PSSessionConfiguration -name IncObj -MaximumReceivedObjectSizeMB 20

WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Plugin\IncObj\InitializationParameters
ParamName ParamValue
--------- ----------
psmaximumreceivedobjectsizemb 20
"Restart WinRM service"
WinRM service need to be restarted to make the changes effective. Do you want to run the command "restart-service winrm"?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y



This example shows sample output from the Set-PSSessionConfiguration cmdlet.

The Set-PSSessionConfiguration command in this example increases the value of the MaximumReceivedObjectSizeMB property to 20.

The Set-PSSessionConfiguration command returns a Microsoft.WSMan.Management.WSManConfigLeafElement object that shows the parameter name and
new value.

It also prompts you to restart the WinRM service. The Set-PSSessionConfiguration change is not effective until the WinRM service is restarted.








-------------------------- EXAMPLE 4 --------------------------

The first command uses the Set-PSSessionConfiguration cmdlet to change the startup script in the MaintenanceShell session configuration to
Maintenance.ps1. The output of this command shows the change and prompts you to restart the WinRM service. The response is "y" (yes).
PS C:\>Set-PSSessionConfiguration -Name MaintenanceShell -StartupScript C:\ps-test\Maintenance.ps1
WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Plugin\MaintenanceShell\InitializationParameters

ParamName ParamValue
--------- ----------
startupscript c:\ps-test\Mainte...

"Restart WinRM service"
WinRM service need to be restarted to make the changes effective. Do you want to run
the command "restart-service winrm"?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y


The second command uses the Get-PSSessionConfiguration cmdlet to get the MaintenanceShell session configuration. The command uses a pipeline
operator (|) to send the results of the command to the Format-List cmdlet, which displays all of the properties of the session configuration
object in a list.
PS C:\>Get-PSSessionConfiguration MaintenanceShell | Format-List -Property *
xmlns : http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration
Name : MaintenanceShell
Filename : %windir%\system32\pwrshplugin.dll
SDKVersion : 1
XmlRenderingType : text
lang : en-US
PSVersion : 2.0
startupscript : c:\ps-test\Maintenance.ps1
ResourceUri : http://schemas.microsoft.com/powershell/MaintenanceShell
SupportsOptions : true
ExactMatch : true
Capability : {Shell}
Permission :

The third command uses the WSMan provider to view the initialization parameters for the MaintenanceShell configuration. The command uses the
Get-ChildItem cmdlet (alias = dir) to get the child items in the InitializationParameters node for the MaintenanceShell plug-in.For more
information about the WSMan provider, type "get-help wsman".
PS C:\>dir WSMan:\localhost\Plugin\MaintenanceShell\InitializationParameters
ParamName ParamValue
--------- ----------
PSVersion 2.0
startupscript c:\ps-test\Maintenance.ps1



This example shows different ways of viewing the results of a Set-PSSessionConfiguration command.