PowerShell Logo Small

Set-PSSessionConfiguration



This is the built-in help made by Microsoft for the command 'Set-PSSessionConfiguration', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' 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 [-AssemblyName] <string> [-ConfigurationTypeName] <string> [-Name] <string> [-ApplicationBase <string>] [-Force] [-Max
imumReceivedDataSizePerCommandMB <double>] [-MaximumReceivedObjectSizeMB <double>] [-NoServiceRestart] [-SecurityDescriptorSDDL <string>] [-ShowS
ecurityDescriptorUI] [-StartupScript <string>] [-ThreadApartmentState {STA | MTA | Unknown}] [-ThreadOptions {Default | UseNewThread | ReuseThrea
d | UseCurrentThread}] [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Set-PSSessionConfiguration cmdlet changes the properties of the registered session configurations 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.

Use the Name parameter to identify the configuration that you want to change. Use the other parameters to specify new values for the properties o
f 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.

To see the properties of a session configuration, use the Get-PSSessionConfiguration cmdlet or the WS-Management Provider. For more information a
bout the WS-Management Provider, type "get-help wsman".



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=144307
about_Session_Configurations
Disable-PSSessionConfiguration
Enable-PSSessionConfiguration
Get-PSSessionConfiguration
Register-PSSessionConfiguration
Unregister-PSSessionConfiguration
WS-Management
Provider



REMARKS

<

Examples


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

C:\PS>set-pssessionconfiguration -name MaintenanceShell -threadApartmentState STA



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

C:\PS>register-pssessionconfiguration -name AdminShell -assemblyName c:\shells\AdminShell.dll -configurationType AdminClass

C:\PS> set-pssessionconfiguration -name AdminShell -startupScript AdminConfig.ps1

C:\PS> set-pssessionconfiguration -name AdminShell -startupScript $null



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

The first command uses the Register-PSSessionConfiguration cmdlet to create the AdminShell configuration.

The second command uses the Set-PSSessionConfiguration cmdlet to add the AdminConfig.ps1 script to the configuration. The change is effective whe
n you restart WinRM.

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.








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

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

WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Plugin\foo\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



Description
-----------
This example show 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 v
alue.

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








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

C:\PS>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


C:\PS> 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 :


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

ParamName ParamValue
--------- ----------
PSVersion 2.0
startupscript c:\ps-test\Maintenance.ps1



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

The first command uses the Set-PSSessionConfiguration cmdlet to change the startup script in the MaintenanceShell configuration to Maintenance.ps
1. The output of this command shows the change and prompts you to restart the WinRM service. The response is "y" (yes).

The second command uses the Get-PSSessionConfiguration cmdlet to get the MaintenanceShell session configuration. The command uses a pipeline oper
ator (|) to send the results of the command to the Format-List cmdlet, which displays all of the properties of the session configuration object i
n a list.

The third command uses the WS-Management 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 WS-Management provider, type "get-help wsman".