Jump to content

Reboot PCs weekly


D8TA

Recommended Posts

I am trying to figure out how I can create a scheduled task running as our administrator, local accounts don't have rights, to reboot the PCs on Saturday and do this weekly. We don't have Active Directory up and running yet but should in a couple of months.

Our policy is to have all users restart their PCs at the end of the day. Many users just log off and some updates we push out don't get applied, especially patches. So I am trying to figure out how I can create either a script or bat file to create a scheduled task to run shutdown.exe on all the PCs on the network. I was looking at "at 00:00 cmd /c shutdown.exe" but I have no clue what I am doing. The image we use to deploy new machines already have this shutdown as a scheduled task. We use the Netware client if that helps anyone out.

Any and all help would be appreciated.

Link to comment
Share on other sites


Easy enough to do. Put something like this in your build scripts:

Schtasks /create /sc daily /mo 1 /st 20:01:00 /tn Maintenance /tr "<path>\Reboot.cmd" /ru <admin user> /rp <password>

This creates a scheduled task. The example above will run daily at 8:01pm and is called "Maintenance" in the Scheduled Tasks listing.

/create - Creates a task

/sc daily - specify the schedule as daily

/mo 1 - sets it to run each day (as opposed to a "2" which would be every other day)

/st - start time (in 24hr clock)

/tn - Task name

/tr - Task to run

/ru - runas user

/rp - runas user password

In your case you'd want to use "/sc weekly /d SAT /st 00:00:01" to run it at 12:00:01 on Saturday mornings, as opposed to my daily at 8:01pm.

Hope this helps.

Link to comment
Share on other sites

  • 4 weeks later...

I created a task using the described method and it did place the schedule task in with the local admin user but it doesn't run. These PCs are in an Active Directory domain so do they need a domain admin username and password? I have been trying to set the scheduled task to run under System but I am not sure how to do that.

Any other suggestions would be greatly appreciated!

Link to comment
Share on other sites

Hi,

I did this because we needed to delete user profiles from workstations and the ntuser.dat was locked.. so by rebooting the workstation I could delete the user profiles.

To do this

I used Icon (http://surguy.net/articles/icron.xml) Its a windows implementation of crontab

Then created an autoit script (http://www.autoitscript.com/autoit3/) to reboot the workstation and compiled to exe. In the autoit script I used a process check to see if the process "explorer.exe" was running.. If so do nothing as a user was logged on.

Works really well for me. :thumbup

if you need any info on the script and stuff just shout :hello:

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...