Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

How can I schedule my computer to shutdown, restart and log into a user account automatically?


  • Please log in to reply
10 replies to this topic

#1 Wang Yuan Ji

Wang Yuan Ji

  • Members
  • 139 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:27 PM

Posted 26 June 2011 - 08:42 PM

On my other topic, a Distinguished Member suggested that the topic might be better suited in the Programming Forum. Since the topic has received 176 views and only 1 reply, I decided to take his/her advice and move the topic to this forum.

Old Topic

Hi, I almost always leave the computer running. The main reasons I do this is for convenience and so Avast can perform scheduled scans. Based on what I've learned, it's a really good idea to restart the computer once in a while. I'm opting to restart the computer once a day (an hour before Avast's scheduled scan). I think I figured out how to make the computer shutdown and restart automatically. I went to Start > Control Panel > Scheduled Tasks > Add Scheduled Task and created the following task:

Name: AutoRestart

Run: C:\WINDOWS\system32\shutdown.exe -r -f -t xx (where "-r" shutdowns and restarts the computer; "-f" forces all running applications closed; "-t xx" delays the shutdown for "xx" seconds (I think)).

Start In: C:\WINDOWS\system32

Additionally, I need the computer to log into a user account of my choice for convenience and so Avast doesn't miss its scheduled scan but I'm not sure how to do this. Perhaps, the program, TweakUI can be used to set an automatic login but CNET does not recommend it to beginners so I would like to avoid using the program.

-

Okay, here's the problem. I managed to figure out how to automatically log into a Windows user account so that is no longer an issue. Please, take a look at the following image: http://www.filedropper.com/taskschedulernopermission

In the image, I click on Set Password. I enter a password then confirm it. Then, I click Apply. When, I click Apply, I receive the prompt displayed next to the AutoStart window.

Edit: Update: I've successfully configured the computer to shutdown, restart and log into Windows automatically. I'm going to make sure browsers don't lose their tabs as a result of "-f xx".

Edited by Wang Yuan Ji, 27 June 2011 - 10:25 AM.


BC AdBot (Login to Remove)

 


#2 Didier Stevens

Didier Stevens

  • BC Advisor
  • 2,698 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:04:27 AM

Posted 28 June 2011 - 05:17 AM

When you use -f, you force programs to be killed when they ask you to save unsaved work. That's usually a bad idea.
And it explains why you lose your tabs.

Didier Stevens
http://blog.DidierStevens.com
http://DidierStevensLabs.com

SANS ISC Senior Handler
Microsoft MVP 2011-2016 Consumer Security, Windows Insider MVP 2016-2019
MVP_Horizontal_BlueOnly.png

 

If you send me messages, per Bleeping Computer's Forum policy, I will not engage in a conversation, but try to answer your question in the relevant forum post. If you don't want this, don't send me messages.

 

Stevens' law: "As an online security discussion grows longer, the probability of a reference to BadUSB approaches 1.0"


#3 Wang Yuan Ji

Wang Yuan Ji
  • Topic Starter

  • Members
  • 139 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:27 PM

Posted 28 June 2011 - 11:52 AM

Oh, I see. If I removed "-f", would programs properly close themselves (saving work) before the computer shutdowns?

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:27 PM

Posted 28 June 2011 - 12:04 PM

That depends what you mean by 'saving work'. The application would need some ability to handle a shutdown; otherwise it is just going to terminate.

#5 Wang Yuan Ji

Wang Yuan Ji
  • Topic Starter

  • Members
  • 139 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:27 PM

Posted 28 June 2011 - 12:07 PM

Hm, I'm not sure how to elaborate. I suppose, for example, is there a way for Firefox to close itself (saving opened tabs) before the computer shutdowns?

Edited by Wang Yuan Ji, 28 June 2011 - 12:08 PM.


#6 Didier Stevens

Didier Stevens

  • BC Advisor
  • 2,698 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:04:27 AM

Posted 28 June 2011 - 02:36 PM

I suppose, for example, is there a way for Firefox to close itself (saving opened tabs) before the computer shutdowns?


Yes, you close Firefox manually when it has several tabs open, and in the dialog you select option "Do not ask next time" and click "Save and Quit".

Didier Stevens
http://blog.DidierStevens.com
http://DidierStevensLabs.com

SANS ISC Senior Handler
Microsoft MVP 2011-2016 Consumer Security, Windows Insider MVP 2016-2019
MVP_Horizontal_BlueOnly.png

 

If you send me messages, per Bleeping Computer's Forum policy, I will not engage in a conversation, but try to answer your question in the relevant forum post. If you don't want this, don't send me messages.

 

Stevens' law: "As an online security discussion grows longer, the probability of a reference to BadUSB approaches 1.0"


#7 Wang Yuan Ji

Wang Yuan Ji
  • Topic Starter

  • Members
  • 139 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:27 PM

Posted 28 June 2011 - 03:34 PM

So, if I understand correctly, it's okay for -f to force applications closed, such as Firefox and NoteTab Light (NoteTab Light is configured to automatically save work every 10 minutes as well as save document(s) when it is closed), that automatically save work?

Edited by Wang Yuan Ji, 28 June 2011 - 03:46 PM.


#8 Didier Stevens

Didier Stevens

  • BC Advisor
  • 2,698 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:04:27 AM

Posted 28 June 2011 - 05:30 PM

So, if I understand correctly, it's okay for -f to force applications closed, such as Firefox and NoteTab Light (NoteTab Light is configured to automatically save work every 10 minutes as well as save document(s) when it is closed), that automatically save work?


No, I don't recommend you use -f. It will terminate applications by killing the process.
Have you tested shutdown.exe without -f? Does your machine restart, or are there applications blocking the restart?

Didier Stevens
http://blog.DidierStevens.com
http://DidierStevensLabs.com

SANS ISC Senior Handler
Microsoft MVP 2011-2016 Consumer Security, Windows Insider MVP 2016-2019
MVP_Horizontal_BlueOnly.png

 

If you send me messages, per Bleeping Computer's Forum policy, I will not engage in a conversation, but try to answer your question in the relevant forum post. If you don't want this, don't send me messages.

 

Stevens' law: "As an online security discussion grows longer, the probability of a reference to BadUSB approaches 1.0"


#9 Wang Yuan Ji

Wang Yuan Ji
  • Topic Starter

  • Members
  • 139 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:27 PM

Posted 28 June 2011 - 05:43 PM

Hi again, no, I haven't tested the shutdown.exe without using -f. I was under the impression I should use it since where I learned how to schedule an automatic reboot also used it. I'll go ahead and try it without -f and see what happens.

Edit: Maybe the -f was responsible for my last BSOD involving NVIDIA. The BC Advisor assisting me with the computer's BSOD's recommended I temporarily disable shutdown.exe to see if it was the caused. Well, I can't say for sure it was, however, I haven't received a BSOD since.

Edited by Wang Yuan Ji, 28 June 2011 - 07:16 PM.


#10 Wang Yuan Ji

Wang Yuan Ji
  • Topic Starter

  • Members
  • 139 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:27 PM

Posted 28 June 2011 - 07:19 PM

Okay, I removed the -f. In order to test shutdown.exe, I opened a document in NoteTab Light and made a change. When shutdown.exe executed, NoteTab Light was closed and then the computer rebooted. When Windows loaded, I opened the document and what I had typed prior to shutdown.exe executing was saved.

Edit: Thanks for clarifying -f. Where I had learned how to schedule this task used -f so I thought I should too.

Edited by Wang Yuan Ji, 28 June 2011 - 07:21 PM.


#11 Tendoncs

Tendoncs

  • Members
  • 25 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:north CA
  • Local time:09:27 PM

Posted 16 August 2011 - 10:44 AM

Here you go.

http://support.microsoft.com/kb/315231

Mod Note: No need to copy and paste data since it is available via the link. Also, one should never, ever, ever mess with the registry without first backing it up. It is possible to render one's system unbootable by screwing up the registry.

Edited by groovicus, 16 August 2011 - 12:13 PM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users