|
|
| Defragmenting computers remotely |
| Written by Terry Watts | |
| Monday, 06 February 2006 | |
|
If you are a network administrator, you may have wondered if there was a way to remotely defrag your workstations. Professional tools like O&O Defrag Enterprise provides this ability, but if you are on a budget, here is an alternative. You may have already read the article on defragmenting tools for Windows, and will have seen some useful command lines that allow you to schedule a defrag using the builtin Windows XP defrag command. What I am going to show you in this article is the ability to proform On-Demand, remote defragmenting. To do this we are going to use the PSEXEC tool from sysinternals. (www.sysinternals.com/Utilities/PsExec.html) PSEXEC is a wonderful tool, that lets an administrator perform remote management tasks on Windows 2000 and XP workstations. There are many command line options and parameters that make this tool very powerful indeed. The tool has the ability to copy files onto the target workstation, giving the administrator the ability to deploy and run the DIRMS utility for example. PSEXEC can also run commands against a whole domain, by specifying \\* as a computer name. Of course this can be quite dangerous, so I would advise against doing this. I am going to assume that you have downloaded and extracted the PSEXEC tool onto your server or admin workstation in a folder called C:\Remote Management. I am also going to assume that your Windows XP computer have the Windows Firewall switched off. Create a new file with Notepad and save it in the C:\Remote Management folder as RemoteDefrag.bat. Remember to change the type option from Text files to All files on the Notepad save dialog, otherwise you will end up with a file called RemoteDefrag.bat.txt that will only open in Notepad and never do anything. Enter the following line into Notepad. Replacing the <computername> with the relevant workstation name. PSEXEC -i -d -s \\<computername> c:\windows\system32\defrag.exe c: Add as many lines as needed, using the unique computer name of each PC on your network. Once you have completed your batch file, double click on it to run. A command window will display the results of the task being run. Showing if the remote command was successful or not. Of course, the above will work fine for Windows XP workstations, but will fail on Windows 2000 machines, this is because Windows 2000 doesn't support the Defrag command. Therefore you can download and use DIRMS instead. PSEXEC -i -d -s \\<computername> -c DIRMS.EXE C: You will need to make sure that DIRMS.EXE is in the same location as PSEXEC, otherwise the file can't be copied onto the target workstation. Now what about this command and its parameters? Well this is actually quite simple. The -i means that the program will run interactively with the user, allowing them to close the task if needed. The -d instructs PSEXEC to move onto the next command in the batch file and not to wait for the command to finish. The -s tells PSEXEC to use the local SYSTEM account of the workstation, avoiding possible permission issues. Some other things to be aware of;
Lastly, the author of this article accepts no responsibility for your use of these notes. |
|
|