PowerShell Logo Small

Disable-PSSessionConfiguration



This is the built-in help made by Microsoft for the command 'Disable-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

Denies access to the session configurations on the local computer.

SYNTAX


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



Search powershellhelp.space

DESCRIPTION


The Disable-PSSessionConfiguration cmdlet prevents all users of the computer from using the session configuration in a session. This is an advanc
ed cmdlet that is designed to be used by system administrators to manage customized session configurations for their users.

The Disable-PSSessionConfiguration cmdlet adds a "deny all" setting to the security descriptor of one or more registered session configurations.
As a result, you can unregister, view, and change the configurations, but you cannot use them in a session.

Without parameters, Disable-PSSessionConfiguration disables the Microsoft.PowerShell configuration, which is the default configuration that is us
ed for sessions. Unless the user specifies a different configuration, both local and remote users are effectively prevented from creating any ses
sions 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/?LinkID=144299
about_Session_Configurations
Enable-PSSessionConfiguration
Get-PSSessionConfiguration
Register-PSSessionConfiguration
Set-PSSessionConfiguration
Unregister-PSSessionConfiguration
WS-Management
Provider



REMARKS

<

Examples


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

C:\PS>Disable-PSSessionConfiguration



Description
-----------
This command disables the Microsoft.PowerShell session configuration.








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

C:\PS>disable-pssessionConfiguration -name *



Description
-----------
This command disables all registered session configurations on the computer.








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

C:\PS>disable-pssessionConfiguration -name Microsoft* -force



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








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

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



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

C:\PS>Get-PSSessionConfiguration | format-table -property Name, Permission -auto

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

C:\PS> Disable-PSSessionConfiguration -name MaintenanceShell -force

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

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


C:\PS> 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_Tr
oubl
eshooting Help topic.
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed



Description
-----------
This example shows the effect of disabling a session configuration.

The first command uses the Get-SessionConfiguration and Format-Table cmdlets to display only the Name and Permission properties of the session co
nfiguration objects. This table format makes it easier to see the values of the objects. The results show that members of the Administrators grou
p are permitted to use the session configurations.

The second command uses the Disable-PSSessionConfiguration cmdlet to disable the MaintenanceShell session configuration. The command uses the For
ce parameter to suppress all user prompts.

The third command repeats the first command. The results show that you can still get the object that represents the MaintenanceShell session conf
iguration even though everyone is denied access to it. The "AccessDenied" entry takes precedence over all other entries in the security descripto
r.

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.

The fifth command attempts to use the MaintenanceShell session configuration in a session. It uses the New-PSSession cmdlet to create a new sessi
on and the ConfigurationName parameter to specify the MaintenanceShell configuration. The results show that the New-PSSession command fails beca
use the user is denied access to the configuration.