Archive for the ‘scripting’ Category


Fix Time Synchronization Errors

April 28, 2007

Andy Goodman (SBS-MVP) posted this article on his blog recently. If you are having time synchronization errors on your servers (they were working, now they are not), this post will help you greatly. I have a server that has been doing this and this mini script helped me.

If your servers are not able to time sync lately, check out the batch of commands below. This set of instructions is for servers that have been synching fine, and all of a sudden just stopped. (If your server has never been able to time sync, see the M&M’s article on synching time on SBS. )

Here are the commands;

w32tm /configure /,0×8 /syncfromflags:MANUAL
net stop w32time
net start w32time
w32tm /resync

Copy and paste those commands into notepad, save the file as timefix.cmd on the desktop of your server. Then just double-click it to run the batch of commands. Be sure to watch the last command and make sure it says the sync was successful.

Note: you may want to change the time source to one local to you (here is a list of time servers), but works fine for me (GMT -5 Eastern USA).


Windows Admin Script: Defrag Drives Based on Threshold

April 22, 2007

I’m going to start sharing some useful scripts that I use to automate many processes. Most of the ones I will share, I have gathered from the Internet and edited. Who knows just what I will share, but I can guarantee they can help you out with many system admin tasks!

The first one I will share is a Defragment script I have implemented to run every day on many of the XP workstations I manage. Defragmentation is a big problem if not taken care of every once in a while.

What is defragmentation? When a file is saved to the hard drive, it tries to keep everything in the same location (or cluster) Over the course of time files will be deleted, leaving blank areas between files. If you install another large program, the hard drive tries to fill the holes, thus breaking up the program storage block. This effects your system performance by as much as 200% since programs have to access more areas of the hard drive, just to run.

The script I will show below is based on a threshold of fragmentation. A drive will be defragmented only if it’s fragmentation percentage is determined to be equal to or greater than the FragThreshold value. You can edit to whatever you want.

REQUIREMENTS: The script has to be executed locally on only XP or Server 2003 systems and under account with permissions to defragment local fixed drives.

Defrag All Drives


System Admin Script Resources

March 26, 2007

I depend on scripting a lot. Probably not as much as some admins, but lately I’ve resolved to scripting to help me roll out system admin tasks. Especially to do stuff like Add/Remove users from Active Directory, User logon scripts, etc. Here are a few excellent web resources for those times you need a script in a pinch.

LabMice.Net – Scripting & Batch Programming Resources
Microsoft TechNet Script Center
The Script Center Script Repository
TechTasks Script Center