• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 307
  • Last Modified:

make windows automatically restart

hi all

what i am looking for is that having computer restart one more time automatically after I manually restart it at beginning. That way i dont have to wait there to do second restart manually.

I am ok with c# or batch file or adding registry

thanks
0
Ikelca
Asked:
Ikelca
  • 5
  • 4
  • 2
1 Solution
 
GovvyCommented:
Create batch file containing 'shutdown /r'
0
 
IkelcaAuthor Commented:
that is not what I am looking for
 because I have to logon to start batch file
I want no touch after first reboot
0
 
GovvyCommented:
Use HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce to point to script
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ReneGeCommented:
1-Create a LocalPolicy or a Computer Group Policy Object to run an AutoRestart batch file at computer startup.

GPO AutoRestart.bat:
If exist "C:\Temp\AutoRestart.txt" (
  del /f /q "C:\Temp\AutoRestart.txt"
  shutdown -f -r -t 1
)


Batch File to restart PC then, auto restart it (Because of the GPO):
ECHO. >"C:\Temp\AutoRestart.txt"
shutdown -f -r -t 1
0
 
ReneGeCommented:
@Govvy:
User will require to logon so that the run once takes effect. This defise the purpose of not waiting for the PC to boot before rebooting.
0
 
IkelcaAuthor Commented:
RUNONCE key require logon to run whatever inside
i have tried that already.

regarding GPO, it may work, but how can I use c# to create a new GPO? that's the question, isn't GPO linking to registry?? if that's the case, which key in registry?
0
 
IkelcaAuthor Commented:
ok this works ReneGe,

but it leaves GPO enabled, is there way to disable that after run?
0
 
ReneGeCommented:
It's not important.

The batch file in the GPO will look IF EXIST "AutoRestart.txt" (The flag file). If it does, it will delete it then automatically restart that booting PC. The fun part of my script, is that once rebooted, when it will look for that flag file, since it has been previously deleted by the GPO batch file, will not reboot it.

Then, if you wish to do that process again, just run the batch file on the PC (Exibit A). It will create the flag file, reboot the PC then, when it is rebooted (before being loged in), the GPO batch file will find the flag file, delete it then reboot.

EXIBIT A:
ECHO. >"C:\Temp\AutoRestart.txt"
shutdown -f -r -t 1
0
 
IkelcaAuthor Commented:
let me try and get back to u
0
 
IkelcaAuthor Commented:
thanks guys, i decided to use scheduled task to run shutdown.exe
0
 
ReneGeCommented:
Glad I could help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now