D8TA Posted September 28, 2006 Share Posted September 28, 2006 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 More sharing options...
mmarable Posted September 28, 2006 Share Posted September 28, 2006 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 passwordIn 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 More sharing options...
Sonic Posted September 28, 2006 Share Posted September 28, 2006 but check version of Windows XP, Schtasks doesn't work in Windows XP Home Edition. Link to comment Share on other sites More sharing options...
LLXX Posted September 29, 2006 Share Posted September 29, 2006 I doubt they would be using XPH on many PCs (seemingly office environment)... XPP VLK more likely. Link to comment Share on other sites More sharing options...
D8TA Posted October 23, 2006 Author Share Posted October 23, 2006 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 More sharing options...
cryton2707 Posted October 25, 2006 Share Posted October 25, 2006 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. if you need any info on the script and stuff just shout Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now