- How to refresh, reset, or restore your PC
- Before you start to refresh or reset your PC
- Refresh, reset, or restore
- To refresh your PC
- To reset your PC
- To restore your PC to an earlier point in time
- Restart-Computer
- Syntax
- Description
- Examples
- Example 1: Restart the local computer
- Example 2: Restart multiple computers
- Example 3: Get computer names from a text file
- Example 4: Force restart of computers listed in a text file
- Example 6: Restart a remote computer and wait for PowerShell
- Example 7: Restart a computer by using WsmanAuthentication
- Parameters
- Inputs
- Outputs
- Notes
How to refresh, reset, or restore your PC
Note: For information about this topic in Windows 10, see Recovery options in Windows 10.
If you’re having problems with your PC, you can:
Refresh your PC to reinstall Windows and keep your personal files and settings. Refresh also keeps the apps that came with your PC and the apps you installed from the Microsoft Store.
Reset your PC to reinstall Windows but delete your files, settings, and apps—except for the apps that came with your PC.
Restore your PC to undo recent system changes you’ve made.
If you’re having trouble starting (booting) your PC, see Windows Startup Settings (including safe mode), and go to the “Get to Windows Startup Settings in the Windows Recovery Environment” section. You can refresh, reset, or restore your PC from the Windows Recovery Environment.
If you want to back up and restore your personal files using File History, see Set up a drive for File History.
Before you start to refresh or reset your PC
In most cases, once you start to refresh or reset your PC, it’ll finish on its own. However, if Windows needs missing files, you’ll be asked to insert recovery media, which is typically on a DVD disc or thumb drive. If that happens, what you’ll need depends on your PC.
If your PC came with Windows 8.1 or Windows RT 8.1, you’ll need the discs or thumb drive that came with your PC. Check the info that came with your PC to see if your PC manufacturer provided these discs or media. In some cases, you might have created them when you first set up your PC.
If you don’t have either of those, you can make them if you have a USB thumb drive of 16 GB or larger. Having a recovery drive can help you troubleshoot and fix problems with your PC, even if it won’t start. For more info, see Create a USB recovery drive.
If you upgraded your PC to Windows 8.1 or Windows RT 8.1 with a DVD, use that disc. If you don’t have Windows 8.1 or Windows RT 8.1 media, contact Microsoft Support.
Refresh, reset, or restore
Select any of the following for more detailed info.
If your PC isn’t performing as well as it once did, and you don’t know why, you can refresh your PC without deleting any of your personal files or changing your settings.
Note: If you upgraded your PC from Windows 8 to Windows 8.1 and your PC has a Windows 8 recovery partition, refreshing your PC will restore Windows 8. You’ll need to upgrade to Windows 8.1 after the refresh has finished.
Warning: Apps you installed from websites and DVDs will be removed. Apps that came with your PC and apps you installed from Microsoft Store will be reinstalled. Windows puts a list of removed apps on your desktop after refreshing your PC.
To refresh your PC
Swipe in from the right edge of the screen, tap Settings, and then tap Change PC settings.
(If you’re using a mouse, point to the upper-right corner of the screen, move the mouse pointer down, click Settings, and then click Change PC settings.)
Tap or click Update and recovery, and then tap or click Recovery.
Under Refresh your PC without affecting your files, tap or click Get started.
Follow the instructions on the screen.
If you want to recycle your PC, give it away, or start over with it, you can reset it completely. This removes everything and reinstalls Windows.
Note: If you upgraded your PC from Windows 8 to Windows 8.1 and your PC has a Windows 8 recovery partition, resetting your PC will restore Windows 8. You’ll need to upgrade to Windows 8.1 after the reset has finished.
Warning: All of your personal files will be deleted and your settings will be reset. All apps that you installed will be removed. Only apps that came with your PC will be reinstalled.
To reset your PC
Swipe in from the right edge of the screen, tap Settings, and then tap Change PC settings.
(If you’re using a mouse, point to the upper-right corner of the screen, move the mouse pointer down, click Settings, and then click Change PC settings.)
Tap or click Update and recovery, and then tap or click Recovery.
Under Remove everything and reinstall Windows, tap or click Get started.
Follow the instructions on the screen.
Note: You’ll be asked to choose whether you want to erase data quickly or thoroughly. If you choose to erase data quickly, some data might be recoverable using special software. If you choose to erase data thoroughly, this will take longer but it makes recovering data less likely.
If you think an app or driver that you recently installed caused problems with your PC, you can restore Windows back to an earlier point in time, called a restore point. System Restore doesn’t change your personal files, but it might remove recently installed apps and drivers.
System Restore isn’t available for Windows RT 8.1.
Windows automatically creates a restore point when you install desktop apps and new Windows updates, if the last restore point is older than 7 days. You can also create a restore point manually at any time.
To restore your PC to an earlier point in time
Swipe in from the right edge of the screen, and then tap Search.
(If you’re using a mouse, point to the upper-right corner of the screen, move the mouse pointer down, and then click Search.)
Enter Control Panel in the search box, and tap or click Control Panel.
Enter Recovery in the Control Panel search box, and then tap or click Recovery.
Tap or click Open System Restore, and then follow the instructions.
If you need additional help refreshing, resetting, or restoring your PC, check out the Repair and Recovery community pages in the Windows forum for solutions that other people have found for problems they’ve experienced.
Restart-Computer
Restarts the operating system on local and remote computers.
Syntax
Description
The Restart-Computer cmdlet restarts the operating system on the local and remote computers.
You can use the parameters of Restart-Computer to run the restart operations, to specify the authentication levels and alternate credentials, to limit the operations that run at the same time, and to force an immediate restart.
Starting in Windows PowerShell 3.0, you can wait for the restart to complete before you run the next command. Specify a waiting time-out and query interval, and wait for particular services to be available on the restarted computer. This feature makes it practical to use Restart-Computer in scripts and functions.
Examples
Example 1: Restart the local computer
Restart-Computer restarts the local computer.
Example 2: Restart multiple computers
Restart-Computer can restart remote and local computers. The ComputerName parameter accepts an array of computer names.
Example 3: Get computer names from a text file
Restart-Computer gets a list of computer names from a text file and restarts the computers. The ComputerName parameter isn’t specified. But because it’s the first position parameter, it accepts the computer names from the text file that are sent down the pipeline.
Get-Content uses the Path parameter to get a list of computer names from a text file, Domain01.txt. The computer names are sent down the pipeline. Restart-Computer restarts each computer.
Example 4: Force restart of computers listed in a text file
This example forces an immediate restart of the computers listed in the Domain01.txt file. The computer names from the text file are stored in a variable. The Force parameter forces an immediate restart.
Get-Content uses the Path parameter to get a list of computer names from a text file, Domain01.txt. The computer names are stored in the variable $Names . Get-Credential prompts you for a username and password and stores the values in the variable $Creds . Restart-Computer uses the ComputerName and Credential parameters with their variables. The Force parameter causes an immediate restart of each computer.
Example 6: Restart a remote computer and wait for PowerShell
Restart-Computer restarts the remote computer and then waits up to 5 minutes (300 seconds) for PowerShell to become available on the restarted computer before it continues.
Restart-Computer uses the ComputerName parameter to specify Server01. The Wait parameter waits for the restart to finish. The For specifies that PowerShell can run commands on the remote computer. The Timeout parameter specifies a five-minute wait. The Delay parameter queries the remote computer every two seconds to determine whether it’s restarted.
Example 7: Restart a computer by using WsmanAuthentication
Restart-Computer restarts the remote computer using the WsmanAuthentication mechanism. Kerberos authentication determines whether the current user has permission to restart the remote computer. For more information, see AuthenticationMechanism.
Restart-Computer uses the ComputerName parameter to specify the remote computer, Server01. The WsmanAuthentication parameter specifies the authentication method as Kerberos.
Parameters
Specifies one computer name or a comma-separated array of computer names. Restart-Computer accepts ComputerName objects from the pipeline or variables.
Type the NetBIOS name, an IP address, or a fully qualified domain name of a remote computer. To specify the local computer, type the computer name, a dot . , or localhost.
This parameter doesn’t rely on PowerShell remoting. You can use the ComputerName parameter even if your computer isn’t configured to run remote commands.
If the ComputerName parameter isn’t specified, Restart-Computer restarts the local computer.
Type: | String [ ] |
Aliases: | CN, __SERVER, Server, IPAddress |
Position: | 0 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Prompts you for confirmation before running Restart-Computer .
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies a user account that has permission to do this action. The default is the current user.
Type a user name, such as User01 or Domain01\User01, or enter a PSCredential object generated by the Get-Credential cmdlet. If you type a user name, you’re prompted to enter the password.
Credentials are stored in a PSCredential object and the password is stored as a SecureString.
For more information about SecureString data protection, see How secure is SecureString?.
Type: | PSCredential |
Position: | 1 |
Default value: | Current user |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the frequency of queries, in seconds. PowerShell queries the service specified by the For parameter to determine whether the service is available after the computer is restarted.
This parameter is valid only together with the Wait and For parameters.
This parameter was introduced in Windows PowerShell 3.0.
If the Delay parameter isn’t specified, Restart-Computer uses a five second delay.
Type: | Int16 |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the behavior of PowerShell as it waits for the specified service or feature to become available after the computer restarts. This parameter is only valid with the Wait parameter.
The acceptable values for this parameter are:
- Default: Waits for PowerShell to restart.
- PowerShell: Can run commands in a PowerShell remote session on the computer.
- WMI: Receives a reply to a Win32_ComputerSystem query for the computer.
- WinRM: Can establish a remote session to the computer by using WS-Management.
This parameter was introduced in Windows PowerShell 3.0.
Type: | WaitForServiceTypes |
Accepted values: | Wmi, WinRM, PowerShell |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Forces an immediate restart of the computer.
Type: | SwitchParameter |
Aliases: | f |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the duration of the wait, in seconds. When the timeout elapses, Restart-Computer returns to the command prompt, even if the computers aren’t restarted.
The Timeout parameter is only valid with the Wait parameter. Timeout overrides the Wait parameter’s indefinite waiting period.
This parameter was introduced in Windows PowerShell 3.0.
Type: | Int32 |
Aliases: | TimeoutSec |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Restart-Computer suppresses the PowerShell prompt and blocks the pipeline until the computers have restarted. You can use this parameter in a script to restart computers and then continue to process when the restart is finished.
The Wait parameter waits indefinitely for the computers to restart. You can use Timeout to adjust the timing and the For and Delay parameters to wait for particular services to become available on the restarted computers.
The Wait parameter isn’t valid when you’re restarting the local computer. If the value of the ComputerName parameter contains the names of remote computers and the local computer, Restart-Computer generates a non-terminating error for Wait on the local computer, but waits for the remote computers to restart.
This parameter was introduced in Windows PowerShell 3.0.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Shows what would happen if the Restart-Computer runs. The Restart-Computer cmdlet isn’t run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the mechanism that is used to authenticate the user credentials. This parameter was introduced in Windows PowerShell 3.0.
The acceptable values for this parameter are: Basic, CredSSP, Default, Digest, Kerberos, and Negotiate.
Credential Security Service Provider (CredSSP) authentication, in which the user credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.
Type: | String |
Accepted values: | Basic, CredSSP, Default, Digest, Kerberos, Negotiate |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Restart-Computer accepts computer names from the pipeline or variables.
Outputs
None
Restart-Computer doesn’t generate any output.
Notes
This cmdlet is only available on Windows platforms.
- Restart-Computer only works on computers running Windows and requires WinRM and WMI to shutdown a system, including the local system.
- Restart-Computer uses the Win32Shutdown method of the Windows Management Instrumentation (WMI) Win32_OperatingSystem class. This method requires the SeShutdownPrivilege privilege be enabled for the user account used to restart the machine.