Here's a quick VB script I wrote:

Runs a passed command line for only local hard drives

Usage: [cscript|wscript] localdrives.vbs [command] [/exclude] [/recheck]
/exclude Does not run command on these drives
/recheck How often to check to see if command has completed. Defaults to
5 seconds

Example: cscript LocalDrives.vbs "%windir%system32defrag.exe %d" /exclude:y:,z:

I use it for things like my Kaseya JKDefrag and chkdsk scripts. Works regardless of the drive letter configuration.

Just remember to use a command line of "%comspec% /c=command >> output.txt" when you want to redirect the program/command's output.Be sure the deleteoutput.txtbefore you run the script.Kaseya scripting requirees ">>" be entered as">>>>".


Legacy Forum Name: VBscript that detects local drives,
Legacy Posted By Username: connectex