Title: Windows in the Enterprise: Best of MyITForum
August 26, 2004 Published by  TechTarget

Windows in the Enterprise: Best of MyITForum

TechTarget
Issue Sponsored By:
  > Receive a FREE T-Shirt from ScriptLogic Corp.




Featured Article

Scripting Defrag in Windows Server 2003
[ by Greg Ramsey, Contributor, myITforum.com ]

Methods named "Defrag" and "DefragAnalysis" (part of Win32_Volume) are used to manage the Defrag utility included with Windows Server 2003.

Microsoft TechNet Script Center provides a nice example for Analyze Volume Defragmentation. The Technet Script Center Repository also has an example for how to defrag a Windows Server 2003 system using WMI:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colVolumes = objWMIService.ExecQuery _
("Select * from Win32_Volume Where Name = 'D:'")
For Each objVolume in colVolumes
errResult = objVolume.Defrag()
Next

Using this information, I created a script to enumerate all local hard drives and to check each one sequentially to see if it needs to be defragmented (TotalPercentFragmentation > 10%). If so, run Defrag. All information is written to the event log.

9459defragit.zip

If you have any questions, you can e-mail me at [EMAIL PROTECTED]

This article first appeared in myITforum, the premier online destination for IT professionals responsible for managing their corporations' Microsoft Windows systems. The centerpiece of myITforum.com is a collection of member forums where IT professionals actively exchange technical tips, share their expertise, and download utilities that help them better manage their Windows environments, specifically Microsoft Systems Management Server (SMS). It is part of the TechTarget network of Web sites. To register for the site and sign up for the myITforum daily newsletter, click here

ABOUT THE AUTHOR:
Greg Ramsey has been working with SMS and desktop deployment since 1998. He currently works for a state agency in Columbus, Ohio. He has extensive knowledge in VBScript (including ADSI, WSH, and WMI), Visual Basic, SMS Installer, and batch files. He is also the team lead for creating/managing both unattended builds and image-based installations using SysPrep.

MORE INFO:

 > 
Defragment All Hard Drives

 > 
Automating Defrag

 > 
WMI Scripting - Basic steps for writing scripts

 > 
Just the FAQs Guide to VB Scripting Basics


 
AD Free T-Shirt When You Evaluate Desktop Authority
Receive a FREE T-Shirt from ScriptLogic after you evaluate Desktop Authority, the industry's leading desktop management tool. Create, standardize, deploy & manage desktop configurations from a single point. Eliminate endless trips to 100's of workstations. Plus the software is now available in an Admin's Toolbox Solution Pack with Active Administrator, the Active Directory management solution. Click here.
 


Contact Us
Sales
For sales inquiries, please contact us at:
[EMAIL PROTECTED]

Editorial
For feedback about any of our articles or to send us your article ideas, please contact us at:
[EMAIL PROTECTED]
Free E-Newsletters!
Select e-newsletters you would like to receive via e-mail!

SearchWin2000: Active Directory Tip
SearchWin2000: Administrator Tips


Not a Member? We'll activate your membership with your subscription.



ABOUT THIS E-NEWSLETTER
TechTarget This e-newsletter is published by TechTarget, the most targeted IT media and events company.
Copyright 2004 TechTarget. All rights reserved.

To unsubscribe from "Windows in the Enterprise: Best of MyITForum":
Go to unsubscribe: http://searchTechTarget.techtarget.com/u?track=NL-36

Please note, unsubscribe requests may take up to 24 hours to process; you may receive additional mailings during that time. A confirmation e-mail will be sent when your request has been successfully processed.

Contact Us:
TechTarget
Member Services
117 Kendrick Street, Suite 800
Needham, MA 02494

Reply via email to