Inputs: Drive letters (or all), and analyze-only option
Minimum ITScripts engine version required: 18.104.22.168
Modifies the target machine: Yes
Name: Defragment Disk Drive
Outputs: Output from running Defrag on target machines
Purpose: Defragment disk drive(s)
Script Version: 22.214.171.124
Target Type: Any
This script allows and administrator to initiate a Diskdefrag on a target machine remotely. The script will query the logical disks using WMI to determine what disks can be defragged on the target and passes in the command similar to the following example:
"cmd /c Defrag.exe $volume /a 1>$fileName 2>&1"
Possible OpsMon status includes:
"Windows NT/2000 do not support command-line defrag"
"Failed to enumerate logical disks"
"None of selected drives found ($driveLetters)"
"Volume $volume is is marked as dirty. You must run chkdsk on the
"Defrag started on $volume (Analyze only)"
"Defrag started on $volume (Analyze and fix)"
"Defrag complete on $volume"
Windows NT/2000 do not support command-line defrag.