To restart a computer from PowerShell prompt or in the script, you can use the command Restart-Computer
To restart the computer after your confirmation, use the following syntax.
PowerShell will prompt for confirmation, as shown below.
- When prompted: Are you sure you want to perform this action?
- Give Y
- Your computer will be restarted