PowerShell Logo Small


This is the built-in help made by Microsoft for the command 'Unregister-PSSessionConfiguration', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 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.


Deletes registered session configurations from the computer.


Unregister-PSSessionConfiguration [-Name] <String> [-Force] [-NoServiceRestart] [-Confirm] [-WhatIf] [<CommonParameters>]

Search powershellhelp.space


The Unregister-PSSessionConfiguration cmdlet deletes registered session configurations from the computer. This is an advanced cmdlet that is designed to be used by system
administrators to manage customized session configurations for their users.

To make the change effective, Unregister-PSSessionConfiguration restarts the WinRM service. To prevent the restart, use the NoServiceRestart parameter.

If you accidentally delete the default Microsoft.PowerShell or Microsoft.PowerShell32 session configurations, use the Enable-PSRemoting function to restore them. For more
information, see about_Session_Configurations.



Online Version: http://go.microsoft.com/fwlink/p/?linkid=289620
WSMan Provider




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

PS C:\>unregister-pssessionconfiguration -name MaintenanceShell

This command deletes the MaintenanceShell session configuration from the computer.

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

PS C:\>unregister-pssessionconfiguration -name MaintenanceShell -force

This command deletes the MaintenanceShell session configuration from the computer. The command uses the Force parameter to suppress all user messages and to restart the
WinRM service without prompting.

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

PS C:\>unregister-pssessionconfiguration -name *
PS C:\>get-pssessionconfiguration -name * | unregister-pssessionconfiguration

These commands delete all of the session configurations on the computer. The commands have the same effect and can be used interchangeably.

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

PS C:\>unregister-pssessionconfiguration -name maintenanceShell -noServiceRestart
PS C:\>get-pssessionconfiguration -name maintenanceShell

Get-PSSessionConfiguration -name maintenanceShell : No Session Configuration matches criteria "maintenanceShell".
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException

PS C:\>new-pssession -configurationName MaintenanceShell

Id Name ComputerName State Configuration Availability
-- ---- ------------ ----- ------------- ------------
1 Session1 localhost Opened MaintenanceShell Available

PS C:\>restart-service winrm
PS C:\>new-pssession -configurationName MaintenanceShell

[localhost] Connecting to remote server failed with the following error message : The WS-Management service cannot process the request. The resource URI
(http://schemas.microsoft.com/powershell/MaintenanceShell) was not found in the WS-Management catalog. The catalog contains the metadata that describes resources, or logical
endpoints. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed

This example shows the effect of using the NoServiceRestart parameter of Unregister-PSSessionConfiguration. This parameter is designed to prevent a service restart, which
would disrupt any sessions on the computer.

The first command uses the Unregister-PSSessionConfiguration cmdlet to deletes the MaintenanceShell session configuration. However, because the command uses the
NoServiceRestart parameter, the WinRM service is not restarted and the change is not yet completely effective.

The second command uses the Get-PSSessionConfiguration cmdlet to get the MaintenanceShell session. Because the session has been removed from the WS-Management resource
table, Get-PSSession cannot return it.

The third command uses the New-PSSession cmdlet to create a session on the local computer that uses the MaintenanceShell configuration. The command succeeds.

The fourth command uses the Restart-Service cmdlet to restart the WinRM service.

The fifth command again uses the New-PSSession cmdlet to create a session that uses the MaintenanceShell configuration. This time, the session fails because the
MaintenanceShell configuration has been deleted.