I'm trying to find a one-size fits all wbadmin
script that I can deploy to a variety of Server 2008 R2 servers.
The catch I'm having is that whilst all of the servers have a C:, some have an E:, some an E: and an F: and some have just an F:.
The following command:
wbadmin enable backup -addtarget:\\backup1\Backups -schedule:23:00 -systemState -allCritical -vssFull -user:backupservice@domain.local -password:ladidada -quiet
Only backs up the C: and I don't see any options in wbadmin
to back up all the local drives. And of course, if I try shoot the problem with a machine gun (by adding -include:c:,d:,e:,f:
…etc) then we get ERROR - The path specified by 'g:' was not found
.
Please don't tell me that I have to enumarate all the local drives and do it that way. Is there ANY way to tell wbadmin
to include all local drives when backing up?
Best Answer
Here's a variation that automatically avoids cd/dvd. It deliberately backs up hard drives only.
This forms part of a scheduled task which is why
wbadmin start
is used rather thanwbadmin enable
.The bits of interest here are
"drivetype=3"
and usingusebackq
(required).Mark's code was helpful in tracking this down.
The if statements remove the last comma or comma and colon if they exist. Couldn't think of an easier way to do this.
%%a
is copied into_drive
so it can be trimmed to the first 2 characters (C:) using the:~0,2
syntax.