Disable/Enable other Windows services before/after backup

Is there a way to ‘disable’ a Windows service pre-backup, then ‘enable’ the service post-backup?

I looked through the list of “Add advanced option” and in this forum for such but didn’t find anything which might suggest such. Did I miss something?

If the above is not available, is there a way to create and backup a “Volume Shadow Copy”?

Not directly, that would require some scripting.

You can add a --run-script=start-stop.bat advanced option that points to a script.
Something like:

if "%EVENTNAME%" == "BEFORE" GOTO ON_BEFORE
if "%EVENTNAME%" == "AFTER" GOTO ON_AFTER
GOTO end

:ON_BEFORE
sc stop "ServiceName"
GOTO end

:ON_AFTER
sc start "ServiceName"
GOTO end

:end
exit /B 0

A shadow copy is usually a “point-in-time” snapshot of the filesystem and simply backing it up “as-is” is not normally done.

If you really do want to back it up, you can simply give the UNC path as a source in the backup configuration, and it will work. If the name changes in each run, you can use SUBST to map the snapshot (or a part of it) to a drive letter. Use the --run-script approach to do this as well.

If you want to make the backups use VSS, then set --snapshot-policy=required which will create and destroy the snapshots to make a consistent backup.

1 Like