Disable-ComputerRestore

Disables the System Restore feature on the specified file system drive.

语法

Default (默认值)

Disable-ComputerRestore
    [-Drive] <String[]>
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

说明

The Disable-ComputerRestore cmdlet turns off the System Restore feature on one or more file system drives. As a result, attempts to restore the computer do not affect the specified drive.

To disable System Restore on any drive, it must be disabled on the system drive, either first or concurrently.

To re-enable System Restore, use the Enable-ComputerRestore cmdlet. To find the state of System Restore for each drive, use Rstrui.exe.

System restore points and the ComputerRestore cmdlets are supported only on client operating systems, such as Windows 7, Windows Vista, and Windows XP.

示例

Example 1: Disable System Restore on the specified drive

PS C:\> Disable-ComputerRestore -Drive "C:\"

This command disables System Restore on the C: drive.

Example 2: Disable System Restore on multiple drives

PS C:\> Disable-ComputerRestore "C:\", "D:\"

This command disables System Restore on the C: and D: drives. The command uses the Drive parameter, but it omits the Drive parameter name.

参数

-Confirm

Prompts you for confirmation before running the cmdlet.

参数属性

类型:SwitchParameter
默认值:False
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Drive

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 disable System Restore on a remote network drive, even if the drive is mapped to the local computer, and you cannot disable System Restore on drives that are not eligible for System Restore, such as external drives.

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

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:0
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

参数属性

类型:SwitchParameter
默认值:False
支持通配符:False
不显示:False
别名:wi

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

输入

None

You cannot pipe input to this cmdlet.

输出

None

This cmdlet does not generate any output.

备注

  • To run this cmdlet 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.