PowerShell Logo Small

Disable-PSSessionConfiguration



This is the built-in help made by Microsoft for the command 'Disable-PSSessionConfiguration', in PowerShell version 4 - as retrieved from Windows version 'Microsoft Windows 8.1 Enterprise' 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

Disables session configurations on the local computer.

SYNTAX


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



Search powershellhelp.space

DESCRIPTION


The Disable-PSSessionConfiguration cmdlet disables session configurations on the local computer, thereby preventing all users from using the session configurations to
create a user-managed sessions ("PSSessions") on the local computer. This is an advanced cmdlet that is designed to be used by system administrators to manage custom
ized session configurations for their users.


Beginning in Windows PowerShell 3.0, the Disable-PSSessionConfiguration cmdlet sets the Enabled setting of the session configuration (WSMan:\localhost\Plugins\<Sessio
nConfiguration>\Enabled) to "False".


In Windows PowerShell 2.0, the Disable-PSSessionConfiguration cmdlet adds a "Deny_All" entry to the security descriptor of one or more registered session configuratio
ns.


Without parameters, Disable-PSSessionConfiguration disables the Microsoft.PowerShell configuration, which is the default configuration that is used for sessions. Unle
ss the user specifies a different configuration, both local and remote users are effectively prevented from creating any sessions that connect to the computer.


To disable all session configurations on the computer, use Disable-PSRemoting.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=289574
Disable-PSSessionConfiguration
Enable-PSSessionConfiguration
Get-PSSessionConfiguration
New-PSSessionConfigurationFile
New-PSSessionConfigurationOption
Register-PSSessionConfiguration
Set-PSSessionConfiguration
Test-PSSessionConfigurationFile
Unregister-PSSessionConfiguration
WSMan Provider
about_Session_Configurations
about_Session_Configuration_Files

REMARKS

<

Examples


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

PS C:\>Disable-PSSessionConfiguration



This command disables the Microsoft.PowerShell session configuration.




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

PS C:\>Disable-PSSessionConfiguration -Name *



This command disables all registered session configurations on the computer.




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

PS C:\>Disable-PSSessionConfiguration -Name Microsoft* -Force



This command disables all session configurations that have names that begin with "Microsoft". The command uses the Force parameter to suppress all user prompts from t
he command.




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

PS C:\>Get-PSSessionConfiguration -Name MaintenanceShell, AdminShell | Disable-PSSessionConfiguration



This command disables the MaintenanceShell and AdminShell session configurations.

The command uses a pipeline operator (|) to send the results of a Get-PSSessionConfiguration command to Disable-PSSessionConfiguration.








-------------------------- EXAMPLE 5 --------------------------

The first command uses the Get-PSSessionConfiguration and Format-Table cmdlets to display only the Name and Permission properties of the session configuration objects
. This table format makes it easier to see the values of the objects. The results show that members of the Administrators group are permitted to use the session confi
gurations.
PS C:\>Get-PSSessionConfiguration | format-table -property Name, Permission -auto

Name Permission
---- ----------
MaintenanceShell BUILTIN\Administrators AccessAllowed
microsoft.powershell BUILTIN\Administrators AccessAllowed
microsoft.powershell32 BUILTIN\Administrators AccessAllowed


The second command uses the Disable-PSSessionConfiguration cmdlet to disable the MaintenanceShell session configuration. The command uses the Force parameter to suppr
ess all user prompts.
PS C:\>Disable-PSSessionConfiguration -name MaintenanceShell -force

The third command repeats the first command. The results show that you can still get the object that represents the MaintenanceShell session configuration even though
everyone is denied access to it. The "AccessDenied" entry takes precedence over all other entries in the security descriptor.
PS C:\>Get-PSSessionConfiguration | format-table -property Name, Permission -auto

Name Permission
---- ----------
MaintenanceShell Everyone AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell BUILTIN\Administrators AccessAllowed
microsoft.powershell32 BUILTIN\Administrators AccessAllowed


The fourth command uses the Set-PSSessionConfiguration cmdlet to increase the MaximumDataSizePerCommandMB setting on the MaintenanceShell session configuration to 60.
The results show that the command was successful even though everyone is denied access to the configuration.
PS C:\>Set-PSSessionConfiguration -name MaintenanceShell -MaximumReceivedDataSizePerCommandMB 60

ParamName ParamValue
--------- ----------
psmaximumreceived... 60
"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 fifth command attempts to use the MaintenanceShell session configuration in a session. It uses the New-PSSession cmdlet to create a new session and the Configurat
ionName parameter to specify the MaintenanceShell configuration.The results show that the New-PSSession command fails because the user is denied access to the config
uration.
PS C:\>new-pssession -computername localhost -configurationName MaintenanceShell
[localhost] Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_Remote_Troubl
eshooting Help topic.
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed



This example shows the effect of disabling a session configuration.