Kaseya Community

Check for presence of a drive letter

This question is not answered


I'm currently trying to write a script to defrag the data partitions on our customers servers. The problem is that these drive letters aren't consistent through our client base unfortunately. The way I was thinking is that the script looks to see if which drives are available, if D exists, defrag it. Likewise for E etc. What I don't want however, is for the script to fail and generate an alert if the letter doesn't exist, just to silently skip it and carry on with the ones that do.

Almighty Kaseya Community, share with me your wealth of knowledge!

All Replies
  • Procedure Audit Real Drives.xml

    Somebody in this community provided me with this procedure (Audit real drives). it checks for the following:

    • The drive must be a physical local drive
    • Not USB attached
    • Greater then 10GB in size

    It will put the results in a custom field named NOC_Drives (or any other of you change the field name in the procedure). It just might help you in your quest.

  • Where do you get the getrealdisks.exe from?

  • Hi Martin,

    The following command will show you all fixed drives.

    You can use the output in an Agent Procedure.


    wmic logicaldisk where drivetype=3 get name 

    [edited by: Patrick van Strien at 7:23 AM (GMT -8) on Jan 3, 2013] Forgot to paste the command
  • As a followup to Walter you can find all the info you need about the Audit Real Drives procedure in the following thread.


  • billmccl

    Where do you get the getrealdisks.exe from?

    All the information I got, can be found on this post:


  • That's great! However there maybe one slight problem, we're a VSA customer. Can we have custom fields?