Disable-PSSessionConfiguration - PowerShell command help and examples

Denies access to the session configurations on the local computer. (Disable-PSSessionConfiguration)


NAME
Disable-PSSessionConfiguration
SYNOPSIS
Denies access to the session configurations on the local computer.
SYNTAX
Disable-PSSessionConfiguration [[-Name] <string[]>] [-Force] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Disable-PSSessionConfiguration cmdlet prevents all users of the computer from using the session configuration in a session. This is an advanced 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 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. To disable all session configurations on the computer, use Disable-PSRemoting.
PARAMETERS
-Force [<SwitchParameter>] Suppresses all user prompts. By default, you are prompted to confirm each operation. Required? false Position? named Default value False Accept pipeline input? false Accept wildcard characters? false -Name <string[]> Specifies the names of session configurations to disable. Enter one or more configuration names. Wildcards are permitted. You can also pipe a string that contains a configuration name or a session configuration object to Disable-PSSessionConfiguration. If you omit this parameter, Disable-PSSessionConfiguration disables the Microsoft.PowerShell session configuration. Required? false Position? 1 Default value Microsoft.PowerShell Accept pipeline input? true (ByValue, ByPropertyName) Accept wildcard characters? true -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
Microsoft.PowerShell.Commands.PSSessionConfigurationCommands#PSSessionConfiguration, System.String You can pipe a session configuration object or a string that contains the name of a session configuration to Disable-PSSessionConfiguration.
OUTPUTS
None This cmdlet does not return any objects.
NOTES
To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows, you must start Windows PowerShell with the "Run as administrator" option.

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 all 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_Troubl 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 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 configurations. The second command uses the Disable-PSSessionConfiguration cmdlet to disable the MaintenanceShell session configuration. The command uses the Force 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 configuration even though everyone is denied access to it. The "AccessDenied" entry takes precedence over all other entries in the security descriptor. 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 session and the ConfigurationName parameter to specify the MaintenanceShell configuration. The results show that the New-PSSession command fails because the user is denied access to the configuration. 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 C:\Windows>powershell get-help Enable-PSRemoting -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: Denies access to the session configurations on the local computer.

HTTP: ... PS_Windows/en/Disable-PSSessionConfiguration.htm
0.077
19423
What is a UFO file?
Was sind Environment Variablen (Umgebungsvariable)?
WINDOWS SETTING MS SETTINGS QUIETMOMENTSSCHEDULED
WINDOWS SETTING MS SETTINGS REGIONLANGUAGE
Festplatte?
Can I still convert BIN images to ISO on Windows 11?
WINDOWS EINSTELLUNG MS SETTINGS DEVICES TOUCHPAD
What is a file extension, file suffix?
Was ist HDR?
WINDOWS EINSTELLUNG MS SETTINGS REGIONLANGUAGE LANGUAGEOPTIONS



(0)