Kaseya Community

Change drive letter for backup

  • Hi
    Does anyone know if it is possible to write a script that will change a drive letter for a backup that is scheduled.


  • Can you add more details regarding this request

  • Thanks for your response Guillaume

    Except for the normal volume backup with incrementals i have clients that also need to have weekly and monthly backups. This is all done with external hard drives.

    The daily Volume/Incrementals is backed up to a Nas device that is on site. Then they swop out an external hard drive every thursday, so every thursday i have to change the drive letter of the volume backup to point to the external hard drive instead of the Nas device and change it back again the following day for all my clients that needs weekly and /or monthly backups.

    I need to have this done automatically (with a procedure or something else) seeing that Kaseya backup does not support multiple schedules and paths for backups.

  • We had a similar requirement and there are a few options that we found:

    -Use USBDLM (www.uwe-sieber.de/usbdlm_e.html)

    -Use inbuilt Windows utilities

    We took the second route and built our kaseya script around that, using diskpart.exe, and a few utlities to clean up the output

    For all our Backup Drives we have a common label/name (For example 'Backup - Day 1'), the common name being 'Backup', this name is used to search for the drive.

    -We first check to see if the backup drive has the correct drive letter

     dir R: >> C:\kworking\BackupCheck.txt

     Check if this text file has a common directory that we place on all our backup drives

    -If it doesn't detect this drives, it checks to see if the drive is even connected, unfortunately to run diskpart automatically you need to use scripts

     echo list volume >> C:\kworking\DiskPartScript.txt

     diskpart /s C:\kworking\DeskPartScript.txt | findstr Backup >> C:\kworking\Diskpartoutput.txt

     Check if C:\kworking\Diskpartoutput.txt contains Backup

    -Assuming the drive is connected based on the above, we now need to strip the above output to find what volume the drive is assigned, we use head.exe and fart.exe

     head.exe -c10 C:\kworking\Diskpart.txt >> C:\kworking\diskvolume.txt

     fart.exe C:\kworking\diskvolume.txt " Volume" "Volume"

    -Once we've cleaned our output, we assign the volume to a variable and create another diskpart script to change the drive based on this volume

     echo select #diskvolume# >>>> C:\kworking\DiskpartScript2.txt

     echo remove >>>> C:\kworking\DiskpartScript2.txt

     echo assign mount=R: >>>> C:\kworking\DiskpartScript2.txt

    diskpart /s C:\kworking\DiskpartScript2.txt

    -Then finally we do another check to confirm that the drive has infact been changed to R:, same as we did in the begining and cleanup all the temp files that were created.

    You can run this as a pre setup to your BUDR.