Tag Archives: RestorePoint

Restore-Computer

NAME
    Restore-Computer

SYNOPSIS
    Starts a system restore on the local computer.

SYNTAX
    Restore-Computer [-RestorePoint] <int> [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Restore-Computer cmdlet restores the local computer to the specified system restore point.

    A Restore-Computer command restarts the computer. The restore is completed during the restart operation.

PARAMETERS
    -RestorePoint <int>
        Specifies the sequence number of the restore point. To find the sequence number, use Get-ComputerRestorePoint. This parameter is required.

        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 input to this cmdlet.

OUTPUTS
    None
        This cmdlet does not generate any output.

NOTES

        To run a Restore-Computer command on Windows Vista and later versions of Windows, open Windows PowerShell with the “Run as administrator” option.

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

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

    C:\PS>Restore-Computer -RestorePoint 253

    Description
    ———–
    This command restores the local computer to the restore point with sequence number 253.

    Because the RestorePoint parameter is positional, you can omit the parameter name.

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

    C:\PS>Restore-Computer 255 -Confirm

    Confirm
    Are you sure you want to perform this action?
    Performing operation “Restore-Computer” .
    [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “Y”):

    Description
    ———–
    This command restores the local computer to the restore point with sequence number 255. It uses the Confirm parameter to prompt the user before actually performing the operation.

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

    C:\PS>Get-ComputerRestorePoint

    C:\PS> Restore-Computer -RestorePoint 255

    C:\PS> Get-ComputerRestorePoint -LastStatus

    Description
    ———–
    These commands run a system restore and then check its status.

    The first command uses the Get-ComputerRestorePoint cmdlet to get the restore points on the local computer.

    The second command uses Restore-Computer to restore the computer to the restore point with sequence number 255.

    The third command uses the LastStatus parameter of Get-ComputerRestorePoint cmdlet to check the status of the restore operation. Because the Restore-Computer command forces a restart, this command would be entered when the computer restarted.

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

Get-ComputerRestorePoint

NAME
    Get-ComputerRestorePoint

SYNOPSIS
    Gets the restore points on the local computer.

SYNTAX
    Get-ComputerRestorePoint [[-RestorePoint] <Int32[]>] [<CommonParameters>]

    Get-ComputerRestorePoint -LastStatus [<CommonParameters>]

DESCRIPTION
    The Get-ComputerRestorePoint cmdlet gets the restore points on the local computer. This cmdlet can also display the status of the most recent attempt to restore the computer.

    You can use the information returned by Get-ComputerRestorePoint to select a restore point, and you can use the sequence number to identify a restore point for the Restore-Computer cmdlet.

PARAMETERS
    -LastStatus [<SwitchParameter>]
        Gets the status of the most recent system restore operation.

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

    -RestorePoint <Int32[]>
        Gets the restore points with the specified sequence numbers. Enter the sequence numbers of one or more restore points. By default, Get-ComputerRestorePoint gets all restore points on the local computer.

        Required?                    false
        Position?                    1
        Default value                All restore points
        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
    System.Management.ManagementObject#root\default\SystemRestore or String.
        Get-ComputerRestore returns a SystemRestore object, which is an instance of the WMI SystemRestore class. When you use the LastStatus parameter, this cmdlet returns a string.

NOTES

        To run a Get-ComputerRestorePoint command on Windows Vista and later versions of Windows, open Windows PowerShell with the “Run as administrator” option.

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

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

    C:\PS>Get-ComputerRestorePoint

    Description
    ———–
    This command gets all of the restore points on the local computer.

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

    C:\PS>Get-ComputerRestorePoint -RestorePoint 232, 240, 245

    Description
    ———–
    This command gets the restore points with sequence numbers 232, 240, and 245.

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

    C:\PS>Get-ComputerRestorePoint -laststatus

    The last restore failed.

    Description
    ———–
    This command displays the status of the most recent system restore operation on the local computer.

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

    C:\PS>Get-ComputerRestorePoint | Format-Table SequenceNumber, @{Label=”Date”; Expression={$_.ConvertToDateTime($_.CreationTime)}}, Description -auto

    SequenceNumber Date                 Description
    ————– —-                 ———–
             253 8/5/2008 3:19:20 PM Windows Update
             254 8/6/2008 1:53:24 AM Windows Update
             255 8/7/2008 12:00:04 AM Scheduled Checkpoint
    …

    Description
    ———–
    This command displays the restore points in a table for easy reading.

    The Format-Table command includes a calculated property that uses the ConvertToDateTime method to convert the value of the CreationTime property from WMI format to a DateTime object.

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

    C:\PS>((Get-ComputerRestorePoint)[-1]).sequencenumber

    Description
    ———–
    This command gets the sequence number of the most recently created restore point on the computer.

    The command uses the -1 index to get the last item in the array that Get-ComputerRestorePoint returns.

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