Category Archives: Enable

Enable-PSRemoting

NAME
    Enable-PSRemoting

SYNOPSIS
    Configures the computer to receive remote commands.

SYNTAX
    Enable-PSRemoting [-Force] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Enable-PSRemoting cmdlet configures the computer to receive Windows PowerShell remote commands that are sent by using the WS-Management technology.

    You need to run this command only once on each computer that will receive commands. You do not need to run it on computers that only send commands. Because the configuration activates listeners, it is prudent to run it only where it is needed.

    The Enable-PSRemoting cmdlet performs the following operations:

    — Runs the Set-WSManQuickConfig cmdlet, which performs the following tasks:
    —– Starts the WinRM service.
    —– Sets the startup type on the WinRM service to Automatic.
    —– Creates a listener to accept requests on any IP address.
    —– Enables a firewall exception for WS-Management communications.

    — Enables all registered Windows PowerShell session configurations to receive instructions from a remote computer.
    —– Registers the “Microsoft.PowerShell” session configuration, if it is not already registered.
    —– Registers the “Microsoft.PowerShell32” session configuration on 64-bit computers, if it is not already registered.
    —– Removes the “Deny Everyone” setting from the security descriptor for all the registered session configurations.
    —– Restarts the WinRM service to make the preceding changes effective.

    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.

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

    -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
    None
        You cannot pipe input to this cmdlet.

OUTPUTS
    System.String
        Enable-PSRemoting returns strings that describe its results.

NOTES

    ————————– EXAMPLE 1 ————————–

    C:\PS>Enable-PSRemoting

    Description
    ———–
    This command configures the computer to receive remote commands.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Enable-PSRemoting -Force

    Description
    ———–
    This command configures the computer to receive remote commands. It uses the Force parameter to suppress the user prompts.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=144300
    about_remote
    about_Session_Configurations
    Disable-PSRemoting
    Get-PSSessionConfiguration
    Enable-PSSessionConfiguration
    Disable-PSSessionConfiguration
    Register-PSSessionConfiguration
    Set-PSSessionConfiguration
    WS-Management Provider

Enable-PSSessionConfiguration

NAME
    Enable-PSSessionConfiguration

SYNOPSIS
    Enables the session configurations on the local computer.

SYNTAX
    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 [<SwitchParameter>]
        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 [<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 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 ————————–

    C:\PS>Enable-PSSessionConfiguration

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

    ————————– EXAMPLE 2 ————————–

    C:\PS>Enable-PSSessionConfiguration -Name MaintenanceShell, AdminShell

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

    ————————– EXAMPLE 3 ————————–

    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 ————————–

    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.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=144301
    about_Session_Configurations
    Disable-PSSessionConfiguration
    Get-PSSessionConfiguration
    Register-PSSessionConfiguration
    Set-PSSessionConfiguration
    Unregister-PSSessionConfiguration
    WS-Management Provider

Enable-WSManCredSSP

NAME
    Enable-WSManCredSSP

SYNOPSIS
    Enables Credential Security Service Provider (CredSSP) authentication on a client computer.

SYNTAX
    Enable-WSManCredSSP [-Role] <string> [[-DelegateComputer] <string>] [<CommonParameters>]

DESCRIPTION
    The Enable-WSManCredSPP cmdlet enables CredSSP authentication on a client or on a server computer. When CredSSP authentication is used, the user’s credentials are passed to a remote computer to be authenticated. This type of authentication is designed for commands that create a remote session from within another remote session. For example, you use this type of authentication if you want to run a background job on a remote computer.

    This cmdlet is used to enable CredSSP on the client by specifying Client in the Role parameter. The cmdlet then performs the following:

        – Enables CredSSP on the client. The WS-Management setting <localhost|computername>\Client\Auth\CredSSP is set to true.
        – Sets the Windows CredSSP policy AllowFreshCredentials to WSMan/Delegate on the client.
        – Note: These settings allow the client to delegate explicit credentials to a server when server authentication is achieved.

    This cmdlet is used to enable CredSSP on the server by specifying Server in the Role parameter. The cmdlet then performs the following:

     – Enables CredSSP on the server. The WS-Management setting <localhost|computername>\Service\Auth\CredSSP is set to true.
     – Note: This policy setting allows the server to act as a delegate for clients.

    Caution: CredSSP authentication delegates the user’s credentials from the local computer to a remote computer. This practice increases the security risk of the remote operation. If the remote computer is compromised, when credentials are passed to it, the credentials can be used to control the network session.

    To disable CredSSP authentication, use the Disable-WSManCredSSP cmdlet.

PARAMETERS
    -DelegateComputer <string>
        Allows the client credentials to be delegated to the server or servers that are specified by this parameter. The value of this parameter should be a fully qualified domain name.

        If the Role parameter specifies Client, the DelegateComputer parameter is mandatory.
        If the Role parameter specifies Server, the DelegateComputer parameter is not allowed.

        Required?                    false
        Position?                    2
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Role <string>
        Accepts one of two possible values: Client or Server. These values specify whether CredSSP should be enabled as a client or as a server.

        If the Role parameter specifies Client, the cmdlet performs the following:

            – Enables CredSSP on the client. The WS-Management setting <localhost|computername>\Client\Auth\CredSSP is set to true.
            – Sets the Windows CredSSP policy AllowFreshCredentials to WSMan/Delegate on the client.
            – Note: These settings allow the client to delegate explicit credentials to a server when server authentication is achieved.

        If the Role parameter specifies the Server, the cmdlet performs the following:

         – Enables CredSSP on the server. The WS-Management setting <localhost|computername>\Service\Auth\CredSSP is set to true.
         – Note: This policy setting allows the server to act as a delegate for clients.

        Required?                    true
        Position?                    1
        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
    None
        This cmdlet does not accept any input.

OUTPUTS
    System.Xml.XmlElement
        If CredSSP authentication is successfully enabled, this cmdlet generates an XMLElement object.

NOTES

    ————————– EXAMPLE 1 ————————–

    C:\PS>Enable-WSManCredSSP -Role client -DelegateComputer server02.accounting.fabrikam.com

    cfg         : http://schemas.microsoft.com/wbem/wsman/1/config/client/auth
    lang        : en-US
    Basic     : true
    Digest     : true
    Kerberos    : true
    Negotiate : true
    Certificate : true
    CredSSP     : true

    Description
    ———–
    This command allows the client credentials to be delegated to the server02 computer.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Enable-WSManCredSSP -Role client -DelegateComputer *.accounting.fabrikam.com

    cfg         : http://schemas.microsoft.com/wbem/wsman/1/config/client/auth
    lang        : en-US
    Basic     : true
    Digest     : true
    Kerberos    : true
    Negotiate : true
    Certificate : true
    CredSSP     : true

    Description
    ———–
    This command allows the client credentials to be delegated to all the computers in the accounting.fabrikam.com domain.

    ————————– EXAMPLE 3 ————————–

    C:\PS>Enable-WSManCredSSP -Role client -DelegateComputer server02.accounting.fabrikam.com, server03.accounting.fabrikam.com, server04.accounting.fabrikam.com

    cfg         : http://schemas.microsoft.com/wbem/wsman/1/config/client/auth
    lang        : en-US
    Basic     : true
    Digest     : true
    Kerberos    : true
    Negotiate : true
    Certificate : true
    CredSSP     : true

    Description
    ———–
    This command allows the client credentials to be delegated to multiple computers.

    ————————– EXAMPLE 4 ————————–

    C:\PS>Enable-WSManCredSSP -Role server

    Description
    ———–
    This command allows a computer to act as a delegate for another. The Enable-WSManCredSSP cmdlet (shown in the earlier examples) only enables CredSSP authentication on the client, and specifies the remote computers that can act on it’s behalf. In order for the remote computer to act as a delegate for the client, the CredSSP item in the Service node of WSMan must be set to true.

    ————————– EXAMPLE 5 ————————–

    C:\PS>Connect-WSMan server02
    Set-Item WSMan:\server02\service\auth\credSSP -value $true

    Description
    ———–
    This command allows a computer to act as a delegate for another computer. The Enable-WSManCredSSP commands that are shown in the earlier examples enable CredSSP authentication only on the client computer, and they specify the remote computers that can act on behalf of the client computer. For the remote computer to act as a delegate for the client computer, the CredSSP item in the Service directory of the WSMan provider must be set to true.

    In this example, the first command creates a connection to the remote server02 computer.

    The second command sets the credSSP value on the remote server02 computer, which allows the remote computer to act as a delegate.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkId=141442
    Connect-WSMan
    Disable-WSManCredSSP
    Disconnect-WSMan
    Get-WSManCredSSP
    Get-WSManInstance
    Invoke-WSManAction
    New-WSManInstance
    New-WSManSessionOption
    Remove-WSManInstance
    Set-WSManInstance
    Set-WSManQuickConfig
    Test-WSMan

Enable-ComputerRestore

NAME
    Enable-ComputerRestore

SYNOPSIS
    Enables the System Restore feature on the specified file system drive.

SYNTAX
    Enable-ComputerRestore [-Drive] <string[]> [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Enable-ComputerRestore cmdlet turns on the System Restore feature on one or more file system drives. As a result, you can use tools, such as the Restore-Computer cmdlet, to restore the computer to a previous state.

    By default, System Restore is enabled on all eligible drives, but you can disable it, such as by using the Disable-ComputerRestore cmdlet. To enable (or re-enable) System Restore on any drive, it must be enabled on the system drive, either first or concurrently. To find the state of System Restore for each drive, use Rstrui.exe.

PARAMETERS
    -Drive <string[]>
        Specifies the file system drives. Enter one or more file system drive letters, each followed by a colon and a backslash and enclosed in quotation marks, such as “C:\” or “D:\”. This parameter is required.

        You cannot use this cmdlet to enable System Restore on a remote network drive, even if the drive is mapped to the local computer, and you cannot enable System Restore on drives that are not eligible for System Restore, such as external drives.

        To enable System Restore on any drive, System Restore must be enabled on the system drive, either before or concurrently.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -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
    None
        You cannot pipe objects to this cmdlet.

OUTPUTS
    None
        This cmdlet does not generate any output.

NOTES

        Disable-ComputerRestore and Enable-ComputerRestore work only on client operating systems, such as Windows Vista and Windows XP.

        To run an Enable-ComputerRestore command on Windows Vista and later versions of Windows, open Windows PowerShell with the “Run as administrator” option.

        To find the file system drives that are eligible for system restore, in System in Control Panel, see the System Protection tab. To open this tab in Windows PowerShell, type “SystemPropertiesProtection”.

        This cmdlet uses the Windows Management Instrumentation (WMI) SystemRestore class.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Enable-ComputerRestore -Drive “C:\”

    Description
    ———–
    This command enables System Restore on the C: drive of the local computer.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Enable-ComputerRestore -Drive “C:\”, “D:\”

    Description
    ———–
    This command enables System Restore on the C: and D: drives of the local computer.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=135209
    Disable-ComputerRestore
    Get-ComputerRestorePoint
    Restore-Computer
    Restart-Computer

Enable-PSBreakpoint

NAME
    Enable-PSBreakpoint

SYNOPSIS
    Enables the breakpoints in the current console.

SYNTAX
    Enable-PSBreakpoint [-Id] <Int32[]> [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]

    Enable-PSBreakpoint [-Breakpoint] <Breakpoint[]> [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Enable-PSBreakpoint cmdlet re-enables disabled breakpoints. You can use it to enable all breakpoints, or you can specify breakpoints by submitting breakpoint objects or breakpoint IDs.

    A breakpoint is a point in a script where execution stops temporarily so that you can examine the instructions in the script. Newly created breakpoints are automatically enabled, but you can disable them by using the Disable-PSBreakpoint cmdlet.

    Technically, this cmdlet changes the value of the Enabled property of a breakpoint object to True.

    Enable-PSBreakpoint is one of several cmdlets designed for debugging Windows PowerShell scripts. For more information about the Windows PowerShell debugger, see about_debuggers.

PARAMETERS
    -Breakpoint <Breakpoint[]>
        Specifies the breakpoints to enable. Enter a Variable that contains breakpoint objects or a command that gets breakpoint objects, such as a Get-PSBreakpoint command. You can also pipe breakpoint objects to Enable-PSBreakpoint.

        Required?                    true
        Position?                    1
        Default value                None.
        Accept pipeline input?     true (ByValue)
        Accept wildcard characters? false

    -Id <Int32[]>
        Enables breakpoints that have the specified breakpoint IDs. The default value is all breakpoints. Enter the IDs or a Variable that contains the IDs. (You cannot pipe IDs to Enable-PSBreakpoint.) To find the ID of a breakpoint, use the Get-PSBreakpoint cmdlet.

        Required?                    true
        Position?                    1
        Default value                None
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -PassThru [<SwitchParameter>]
        Returns an object representing the enabled breakpoint. By default, this cmdlet does not generate any output.

        Required?                    false
        Position?                    named
        Default value                No output
        Accept pipeline input?     false
        Accept wildcard characters? false

    -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
    System.Management.Automation.Breakpoint
        You can pipe a breakpoint object to Enable-PSBreakpoint.

OUTPUTS
    None or System.Management.Automation.Breakpoint
        When you use the PassThru parameter, Enable-PSBreakpoint returns a breakpoint object that represent that breakpoint that was enabled. Otherwise, this cmdlet does not generate any output.

NOTES

        The Enable-PSBreakpoint cmdlet does not generate an error if you try to enable a breakpoint that is already enabled. As such, you can enable all breakpoints without error, even when only a few are disabled.

        Breakpoints are enabled when you create them by using the Set-PSBreakpoint cmdlet. You do not need to enable newly created breakpoints.

    ————————– EXAMPLE 1 ————————–

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

    Description
    ———–
    This command enables all breakpoints in the current console. You can abbreviate the command as “gbp | ebp”.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Enable-PSBreakpoint -Id 0, 1, 5

    Description
    ———–
    This command enables breakpoints with breakpoint IDs 0, 1, and 5.

    ————————– EXAMPLE 3 ————————–

    C:\PS>$b = Set-PSBreakpoint -script sample.ps1 -variable Name

    C:\PS> $b | Disable-PSBreakpoint -PassThru

    AccessMode : Write
    Variable : Name
    Action     :
    Enabled    : False
    HitCount : 0
    Id         : 0
    Script     : C:\ps-test\sample.ps1
    ScriptName : C:\ps-test\sample.ps1

    C:\PS> $b | Enable-PSBreakpoint -PassThru

    AccessMode : Write
    Variable : Name
    Action     :
    Enabled    : True
    HitCount : 0
    Id         : 0
    Script     : C:\ps-test\sample.ps1
    ScriptName : C:\ps-test\sample.ps1

    Description
    ———–
    These commands re-enable a breakpoint that has been disabled.

    The first command uses the Set-PSBreakpoint cmdlet to create a breakpoint on the “Name” Variable in the Sample.ps1 script. Then, it saves the breakpoint object in the $b Variable.

    The second command uses the Disable-PSBreakpoint cmdlet to disable the new breakpoint. It uses a pipeline operator (|) to send the breakpoint object in $b to the Disable-PSBreakpoint cmdlet, and it uses the PassThru parameter of Disable-PSBreakpoint to display the disabled breakpoint object. This lets you verify that the value of the Enabled property of the breakpoint object is False.

    The third command uses the Enable-PSBreakpoint cmdlet to re-enable the breakpoint. It uses a pipeline operator (|) to send the breakpoint object in $b to the Enable-PSBreakpoint cmdlet, and it uses the PassThru parameter of Enable-PSBreakpoint to display the breakpoint object. This lets you verify that the value of the Enabled property of the breakpoint object is True.

    The results are shown in the following sample output.

    ————————– EXAMPLE 4 ————————–

    C:\PS>$b = Get-PSBreakpoint -Id 3, 5

    C:\PS> Enable-PSBreakpoint -breakpoint $b

    Description
    ———–
    These commands enable a set of breakpoints by specifying their breakpoint objects.

    The first command uses the Get-PSBreakpoint cmdlet to get the breakpoints and saves them in the $b Variable.

    The second command uses the Enable-PSBreakpoint cmdlet and its Breakpoint parameter to enable the breakpoints.
    This command is the equivalent of “Enable-PSBreakpoint -Id 3, 5″.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113295
    about_debuggers
    Set-PSBreakpoint
    Disable-PSBreakpoint
    Get-PSBreakpoint
    Remove-PSBreakpoint
    Get-PSCallStack