Disable session configurations on the local computer.
To prevent all users of the computer from remoting, use Disable-PSRemoting. This is an advanced cmdlet designed for use by system administrators to manage custom session configurations for their users.
Syntax
Disable-PSSessionConfiguration [[-Name] string[]]
[-Force] [-Confirm] [-WhatIf] [CommonParameters]
Key
-Name string
The name(s) of session configurations to disable.
Enter one or more configuration names. Wildcards are permitted.
You can also pipe a configuration name (a string or a session configuration object.)
If you omit this parameter, Disable-PSSessionConfiguration will disable
Microsoft.PowerShell session configuration, which is the default.
-force
Suppress all user prompts.
By default, you are prompted to confirm each operation.
-confirm
Prompt for confirmation before executing the command.
-whatIf
Describe what would happen if you executed the command without actually
executing the command.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -OutVariable.
Beginning in PowerShell 3.0, Disable-PSSessionConfiguration sets the Enabled setting of the session configuration (WSMan:\localhost\Plugins\<SessionConfiguration>\Enabled) to "False".
Without parameters, Disable-PSSessionConfiguration disables the Microsoft.PowerShell configuration, which is the default configuration that is used for sessions. Unless the user specifies a different configuration, both local and
remote users are effectively prevented from creating any sessions that connect to the computer.
Examples
Disable the Microsoft.PowerShell session configuration:
PS C:> Disable-PSSessionConfiguration
Disable all registered session configurations on the computer:
PS C:> disable-pssessionConfiguration -name *
Disable all session configurations that have names that begin with "Microsoft":
PS C:> disable-pssessionConfiguration -name Microsoft* -force
Disable the MaintenanceShell and AdminShell session configurations, via pipe from Get-PSSessionConfiguration:
PS C:> Get-PSSessionConfiguration -name MaintenanceShell, AdminShell | Disable-PSSessionConfiguration
Disable all session configurations that have names that begin with "Microsoft":
PS C:> disable-pssessionConfiguration -name Microsoft* -force
“Economics is about how people make choices; sociology is about how they have no choices to make” ~ David Hackett Fisher
Related PowerShell Cmdlets:
Enable-PSSessionConfiguration - Enable PS session configuration.
Get-PSSessionConfiguration - Get the registered PS session configuration.
Disable-PSRemoting - Disable session configurations on the local computer.