Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows server 2003 - Automatic workstation reboot and defrag nightly?

Status
Not open for further replies.

Unitas99007

IS-IT--Management
Sep 14, 2004
25
0
0
US
Here's what I want, but I don't know how to implement it - I'd like to use Group Policy if possible. I want to force all the clients on a domain to run a defrag every night, then restart, or vice versa. I have to do this for basic maintenance and because the our domain doesn't remind you your password is about to expire unless it is the first time you log in after a restart. We want to force the users to have basic maintenance done to their PC and see the password reminders so they don't keep locking themselves out of the account. Any Ideas????

John Wilson
Anchor Sign, Inc.
NEC NEAX 2000 IVS2
Windows 2003 Server domain
 
I'm not sure that this can be acheived using group policy, i use Psshutdown to schedule the rebooting or shutdown of our PC's. It can be run from a batch file and scheduled.


This vbscript from MS will start a defrag i'm not sure hoe you would schedule it though.


"Sometimes, a cigar is just a cigar." - Sigmund Freud
 
OK, I see how you could do it that way, but surely I'm not the only network admin out there what wants to do this. Thanks for the tip, though. I just don't want to have to download programs or zip files to my servers to enforce a domain behaivior. Any other ideas on how to do this?

John Wilson
Anchor Sign, Inc.
NEC NEAX 2000 IVS2
Windows 2003 Server domain
 
I know what you mean and there probably is a way but some of the articles that i've read basically say to buy the full version of a defrag product that supports scheduling.

Like the full version that comes with Windows.

MS don't include better functionality as i believe they provide a feature with their SMS package for extra $$$.


"Sometimes, a cigar is just a cigar." - Sigmund Freud
 
Are they XP, w2k?

There are a couple ways you could do this. But not with GPO. (Off the top of my head.)
You could use VB script to remotly shutdown a computer. So you could write a simple vbs file that gets the computer names from an OU and remotely reboots them. Or just list the machines in a text file. Then just schedule the script.

NB. The shutdown command also allows for remote reboot. So a simple .bat file that reads a text file would work.

Xp also has a command line defrag which can be scheduled using the same method. What you could also do it add a policy with a 'startup' script that starts the command line defrag. So once the machine reboots defrag starts.
(For w2k you would need to use someting like 'contig' a freeware defrag.)

Hopefully that should help with some ideas.
 
First off, my machines are all WinXP Pro Service Pack 2. So the idea is to run a script that reboots all the machines in an Organizational Unit every night night at say, 3 A.M. on weekdays, then prepare a startup script that once the machine reboots, the machine defrags. I like it. I don't have to download any software. Bofhrevenge2 gave me a sample script above which might work. However, there is a trade-off. If I have to reboot a client in the middle of the day, they have to cancel out of defrag before they can do anything. And if this is enforced via a startup script, will the domain user be able to cancel it out, or will it have to be an admin?

John Wilson
Anchor Sign, Inc.
NEC NEAX 2000 IVS2
Windows 2003 Server domain
 
.. nother option.

Make a 'Task' that starts defrag. Copy that task to each machines task folder (using a script). Set it to run say about and hour after the reboot.

Then you dont have to worry about the user, a reboot in the day and the defrag is done by the time the user sit down to work.

For that matter -- make a task to reboot and another defrag. Schedule one an hour after the other. Copy the tasks to all machines using a script. Order a pizza.
 
Okay, got the defrag set, but what do I need to point the task to for the restart? I mean what extension / path / command?

John Wilson
Anchor Sign, Inc.
NEC NEAX 2000 IVS2
Windows 2003 Server domain
 
The shutdown command:
c:\windows\system32\shutdown -r -f

(In a command prompt 'shutdown /?' for more options)
 
Hi,

I don't know if your hardware supports it but maybe you can use something like "wake on lan" to run maintenance scripts.

regards,
MJanssen



 
I just did some testing (just in case)..
I found that using the command line 'at' command worked better then the gui scheduler. Using 'at' I was able to schedule a reboot without anyone having to be logged into the computer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top