Kaseya Community

"Drive with the most free disk space" variable

  • I'm writing a script to run an NTBackup of the system state of a server (for active directory mainly) and I want to have the shell command to use a variable so the command looks something like this:

    ntbackup backup systemstate /J "System State" /F "#DiskWithMostFreeSpace#\systemstate.bkf"

    I know Kaseya manages to do this somehow with Patch Management because File Source has the option of "Copy packages to temp directory on local drive with most free space." Does anyone know how to do this?

    Legacy Forum Name: "Drive with the most free disk space" variable,
    Legacy Posted By Username: mclark@outsourceitcorp.com
  • freedrv.zip
    Just saw a private message from another user looking for a solution to this. The simple answer is: vbs. File is attached.

    We just pull the content of the output file (which is just a drive letter, like D) and use it in the script. What I typically do (as you'll see in the script) is leave the output file on the drive (c:\freedrv.txt) for my NTBackups and have the script check to see if the file exists, if so, then don't run the vbs again so that it doesn't run and see that C now has more free space than D because D now has a BKF on it. The only downside is if I have to point my NTBackups to another location then I have to open the .txt and edit the drive letter, or delete it and run the script again. It hasn't really been an issue though.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: mclark@outsourceitcorp.com