Enables the session configurations on the local computer.

Syntax

  Copy Code
Enable-PSSessionConfiguration [[-Name] <string[]>] [-Force] [-SecurityDescriptorSDDL <string>] [-Confirm] [-WhatIf] [<CommonParameters>]

Description

The Enable-PSSessionConfiguration cmdlet re-enables registered session configurations that have been disabled by using the Disable-PSSessionConfiguration cmdlet. This is an advanced cmdlet that is designed to be used by system administrators to manage customized session configurations for their users.

Without parameters, Enable-PSSessionConfiguration re-enables the Microsoft.PowerShell configuration, which is the default configuration that is used for sessions.

This cmdlet performs the following operations for each enabled configuration:

-- Removes the "deny all" setting from the security descriptor of the configuration or replaces the security descriptor with one that you specify.

-- Turns on the listener that accepts requests on any IP address.

-- Restarts the WinRM service.

The Enable-PSSessionConfiguration cmdlet calls the Set-WSManQuickConfig cmdlet. However, it should not be used to enable remoting on the computer. Instead, use the more comprehensive cmdlet, Enable-PSRemoting.

Parameters

-Force

Suppresses all user prompts, and restarts the WinRM service without prompting. Restarting the service makes the configuration change effective.

To prevent a restart and suppress the restart prompt, use the NoServiceRestart parameter.

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name <string[]>

Specifies the names of session configurations to enable. 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 Enable-PSSessionConfiguration.

If you omit this parameter, Enable-PSSessionConfiguration enables the Microsoft.PowerShell session configuration.

Required?

false

Position?

1

Default Value

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Accept Wildcard Characters?

true

-SecurityDescriptorSDDL <string>

Replaces the security descriptor on the session configuration with the specified security descriptor.

If you omit this parameter, Enable-PSSessionConfiguration just deletes the "deny all" item from the security descriptor.

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before executing the command.

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

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 command supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, OutBuffer, OutVariable, WarningAction, and WarningVariable. For more information, see about_CommonParameters.

Inputs and Outputs

The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns.

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 Enable-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.

Example 1

  Copy Code
C:\PS>Enable-PSSessionConfiguration

Description
-----------
This command re-enables the Microsoft.PowerShell default session configuration on the computer.






Example 2

  Copy Code
C:\PS>Enable-PSSessionConfiguration -name MaintenanceShell, AdminShell

Description
-----------
This command re-enables the MaintenanceShell and AdminShell session configurations on the computer.






Example 3

  Copy Code
C:\PS>Enable-PSSessionConfiguration -name *

C:\PS> Get-PSSessionConfiguration | Enable-PSSessionConfiguration

Description
-----------
These commands re-enable all session configurations on the computer. The commands are equivalent, so you can use either one.

Enable-PSSessionConfiguration does not generate an error if you enable a session configuration that is already enabled.






Example 4

  Copy Code
C:\PS>Enable-PSSessionConfiguration -name MaintenanceShell -securityDescriptorSDDL "O:NSG:BAD:P(A;;GXGWGR;;;BA)(A;;GAGR;;;S-1-5-21-123456789-188441444-3100496)S:P"

Description
-----------
This command re-enables the MaintenanceShell session configuration and specifies a new security descriptor for the configuration.






See Also