Within PowerShell 2.0 running in Windows XP, I execute the following command:

Restart-Computer

And get the following message:

Windows cannot end this program. It may need more time to complete an operation.

To return to Windows and check the status of the program, click Cancel.

If you choose to end the program immediately, you will lose any unsaved data. To end the program now, click End Now.

This happens whether I restart from PowerShell or from Windows itself. Any idea how I can restart a computer that will close a PowerShell console without prompt?

link|improve this question
feedback

2 Answers

up vote 7 down vote accepted

Use -Force to cause an immediate restart of the computer

link|improve this answer
feedback

One way is to use shutdown.exe with the -f parameter. Run shutdown /? from a cmd window for the full details.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.