Set-PSSessionConfiguration - PowerShell command help and examples

Changes the properties of a registered session configuration. (Set-PSSessionConfiguration)


NAME
Set-PSSessionConfiguration
SYNOPSIS
Changes the properties of a registered session configuration.
SYNTAX
Set-PSSessionConfiguration [-AssemblyName] <string> [-ConfigurationTypeName] <string> [-Name] <string> [-ApplicationBase <string>] [-Force] [-MaximumReceivedDataSizePerCommandMB <double>] [-MaximumReceivedObjectSizeMB <double>] [-NoServiceRestart] [-SecurityDescriptorSDDL <string>] [-ShowSecurityDescriptorUI] [-StartupScript <string>] [-ThreadApartmentState {STA | MTA | Unknown}] [-ThreadOptions {Default | UseNewThread | ReuseThread | UseCurrentThread}] [-Confirm] [-WhatIf] [<CommonParameters>]
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 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. To see the properties of a session configuration, use the Get-PSSessionConfiguration cmdlet or the WS-Management Provider. For more information about the WS-Management Provider, type "get-help wsman".
PARAMETERS
-ApplicationBase <string> Changes the path to the assembly file (*.dll) that is specified in the value of the AssemblyName parameter. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -AssemblyName <string> Specifies a different assembly file for the configuration. Enter the path (optional) and file name of an assembly (.dll) file that defines the configuration type. If you enter only the name, you can enter the path in the value of the ApplicationBase parameter. Required? true Position? 2 Default value Accept pipeline input? false Accept wildcard characters? false -ConfigurationTypeName <string> Specifies a different configuration type for the configuration. The type that you specify must implement the System.Management.Automation.Remoting.PSSessionConfiguration class. If you enter "$null" or an empty string, the DefaultRemotePowerShellConfiguration class is used for the session configuration. Required? true Position? 3 Default value Accept pipeline input? false Accept wildcard characters? false -Force [<SwitchParameter>] Suppresses all user prompts, and restarts the WinRM service without prompting. Restarting the service makes the configuration change effective. To prevent a restart and suppress the restart prompt, use the NoServiceRestart parameter. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -MaximumReceivedDataSizePerCommandMB <double> Changes the limit on the amount of data that can be sent to this computer in any single remote command. Enter the data size in megabytes (MB). The default is 50 MB. If a data size limit is defined in the configuration type that is specified in the ConfigurationTypeName parameter, the limit in the configuration type is used and the value of this parameter is ignored. Required? false Position? named Default value 50 Accept pipeline input? false Accept wildcard characters? false -MaximumReceivedObjectSizeMB <double> Changes the limits on the amount of data that can be sent to this computer in any single object. Enter the data size in megabytes (MB). The default is 10 MB. If an object size limit is defined in the configuration type that is specified in the ConfigurationTypeName parameter, the limit in the configuration type is used and the value of this parameter is ignored. Required? false Position? named Default value 10 Accept pipeline input? false Accept wildcard characters? false -Name <string> Specifies the name of the session configuration that you want to change. You cannot use this parameter to change the name of the session configuration. Required? true Position? 1 Default value Accept pipeline input? false Accept wildcard characters? false -NoServiceRestart [<SwitchParameter>] Does not restart the WinRM service, and suppresses the prompt to restart the service. By default, when you enter a Set-PSSessionConfiguration command, you are prompted to restart the WinRM service to make the new session configuration effective. Until the WinRM service is restarted, the new session configuration is not effective. To restart the WinRM service without prompting, use the Force parameter. To restart the WinRM service manually, use the Restart-Service cmdlet. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -SecurityDescriptorSDDL <string> Specifies a different Security Descriptor Definition Language (SDDL) string for the configuration. This string determines the permissions that are required to use the new session configuration. To use a session configuration in a session, users must have at least "Execute(Invoke)" permission for the configuration. To use the default security descriptor for the configuration, enter an empty string ("") or a value of $null. The default is the root SDDL in the WSMan: drive. If the security descriptor is complex, consider using the ShowSecurityDescriptorUI parameter instead of this one. You cannot use both parameters in the same command. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -ShowSecurityDescriptorUI [<SwitchParameter>] Displays a property sheet that helps you to create a new SDDL for the session configuration. The property sheet appears after you enter the Set-PSSessionConfiguration command and then restart the WinRM service. When setting the permissions to the configuration, remember that users must have at least "Execute(Invoke)" permission to use the session configuration in a session. You cannot use the SecurityDescriptorSDDL parameter and this parameter in the same command. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -StartupScript <string> Adds or changes the startup script for the configuration. Enter the fully qualified path to a Windows PowerShell script. The specified script runs in the new session that uses the session configuration. To delete a startup script from a session configuration, enter an empty string ("") or a value of $null. You can use a startup script to further configure the user's session. If the script generates an error (even a non-terminating error), the session is not created and the user's New-PSSession command fails. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -ThreadApartmentState <ApartmentState> Changes the apartment state setting for the threads in the session. Valid values are STA, MTA and Unknown. Unknown is the default. Required? false Position? named Default value ApartmentState.Unknown Accept pipeline input? false Accept wildcard characters? false -ThreadOptions <PSThreadOptions> Changes the thread options setting in the configuration. This setting defines how threads are created and used when a command is executed in the session. Valid values are Default, ReuseThread, UseCurrentThread, and UseNewThread. UseCurrentThread is the default. Required? false Position? named Default value PSThreadOptions.UserCurrentThread Accept pipeline input? false Accept wildcard characters? false -Confirm [<SwitchParameter>] Prompts you for confirmation before executing the command. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -WhatIf [<SwitchParameter>] Describes what would happen if you executed the command without actually executing the command. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false <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.WSMan.Management.WSManConfigLeafElement
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. The Set-PSSessionConfiguration cmdlet does not change the configuration name and the WS-Management provider does not support the Rename-Item cmdlet. To change the name of a configuration, use the Unregister-PSSessionConfiguration cmdlet to delete the configuration and then use the Register-PSSessionConfiguration cmdlet to create and register a new session configuration. You can use the Set-PSSessionConfiguration cmdlet to change the default Microsoft.PowerShell and Microsoft.PowerShell32 session configurations. They are not protected. To revert to the original version of a default session configuration, use the Unregister-PSSessionConfiguration cmdlet to delete the default session configuration and then use the Enable-PSRemoting cmdlet to restore it.

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 when 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 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
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.ps1. 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 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. 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". 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 C:\Windows>powershell get-help Enable-PSSessionConfiguration -full

Microsoft Windows [Version 10.0.19045.3693]
Copyright (c) 2023 Microsoft Corporation.

ColorConsole [Version 3.7.1000] PowerShell 2.0-Export

Windows 11, 10, 8.1, 8, 7 / Server 2022, 2019, 2016











Windows-10


... Windows 10 FAQ
... Windows 10 How To


Windows 10 How To


... Windows 11 How To
... Windows 10 FAQ



PowerShell: Changes the properties of a registered session configuration.

HTTP: ... PS_Windows/en/Set-PSSessionConfiguration.htm
0.077
18241

Windows 8.1, 11, 10: Where are the default images for users (picture, directory)!

Blockieren von IP-Adressen mithilfe der Windows-Firewall!

Wie kann ich Clear Type in Windows 8.1 und 10 deaktivieren?

Can I disable Spell-Checking or Auto-Correction in Windows 8.1 and Win 10?

Log in to www.yahoo.com, crack the password, or register for FreeMail?

Tastaturgeschwindigkeit bei Windows 8.1/8 erhöhen, oder verringern!



(0)