Schedule Server 2003 Backup Batch File

I have a batch file in Windows 7 Professional that runs RASDIAL and creates a VPN to Windows Server 2003. The batch file then maps a drive and then I do a backup routine. This batch file runs flawlessly by double clicking it.
- Apr 13, 2009 Customizing Windows Server Backup Schedule Windows Server Backup (WSB) is the built-in backup solution for Windows Server 2008 that replaces the venerable NT Backup from Windows Server 2003 and before.
- Jul 21, 2010 - Add to the batch file a call to RoboCopy to transfer the backups to our. (I'm using Windows Server 2003 here – if I was on Windows Server.
Computer is a member server running Windows 2003 SVR in an Windows SBS domain. I have scheduled a simple batch file to run in Windows Schedule Task using the domain administrator account.
Using Task Scheduler, the batch file executes properly except for the net use command. Here is the capture from the command window:
C:UsersMikeDesktopmixSBS Connect>rasdial mixsbs_vpn administrator password
Connecting to mixsbs_vpn..
Verifying username and password..
Registering your computer on the network..
Successfully connected to mixsbs_vpn.
Command completed successfully.
C:UsersMikeDesktopmixSBS Connect>net use * /delete /yes
You have these remote connections:
Z: mixSBSmix Data
Continuing will cancel the connections.
The command completed successfully.
C:UsersMikeDesktopmixSBS Connect>net use Z: 'mixSBSmix Data' password /USER:Administrator /PERSISTENT:YES
The command completed successfully.
C:UsersMikeDesktopmixSBS Connect>net use
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
OK Z: mixSBSmix Data Microsoft Windows Network
The command completed successfully.
C:UsersMike>net use
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
Unavailable Z: mixSBSmix Data Microsoft Windows Network
The command completed successfully.
The VPN connection shows in the NETWORKING AND SHARING CENTER but the mapped drive does not show in COMPUTER. Can someone tell me what I am doing wrong. Thanks.
Chas
Create a Scheduled task to have your server reboot at a scheduled interval. This works on Windows server 2003 and newer. I have not looked for a solution on Windows server 2000, because we do not have any in out network.
9 Steps total
Step 1: Open the Task Scheduler
Open the Scheduled Task
START ->All Programs ->Accessorier -> System Tools -> Scheduled Tasks
Step 2: Create a new task
Server 2003 Backup And Restore
Double Click on the 'Add a New Scheduled Task'
Step 3: Follow the Scheduled Task Wizard
Click 'Next'
Step 4: Select the program to run
Click on Browse to select the proper program and location to run. Navigate to 'C:WINDOWSSystem32shutdown.exe'
Step 5: Select the Frequency
This is where you set how often you want to 'task' to exicute. So if you wanted your server to reboot weekly you select 'weekly'
Step 6: Select the time and day you want the task to start.
This can be once a week at 3 AM or every Wednesady and Friday nights.
Step 7: Enter the username and password for a user
Refx nexus 2 review. This is the user that the scheduled task will run as. I suggest using an account that has domain admin privileges.
Step 8: You have successfuly scheduled the following task
At this point you would be done, if you wanted the server to shutdown at the scheduled time. We are going to select the Open Advanced options when I click finished. Then click Finish
Step 9: Advanced Options
In the Run option you will see the location of the shutdown program. we are going to add some options.
-r This wil have ther server shutdown and then restart
-f This will force the server to force any running application to close
-t 01 This is a time-out before shutdown.
so the full run command is:
C:WINDOWSsystem32shutdown.exe -r -f -t 01
Select Apply and then OK
You can also look at the scheduled taks properties and change the schedule or frequency of the reboots.
14 Comments
Sql Server Execute Batch File
- SerranoJackson6932 Mar 23, 2009 at 04:36pm
Just be a bit wary of any other scheduled tasks that would be running at the time you specify (Backups, SQL jobs etc.) as obviously they will fail if the server turns itself off half way through
- PimientoSteve5155 Mar 30, 2009 at 11:14am
Or you could type something like the following at the command prompt.
at 03:00 shutdown /r
This will add the scheduled task for the next occurence of that time only, to have it repeat lookup the at command help with 'at /?'.
- PimientoSteve5155 Mar 30, 2009 at 11:15am
You can check for tasks quickly by typing 'at' in the cmd prompt.
- SonoraBruce1124 Mar 2, 2011 at 11:07am
We have schedualed the servers to be doing nothing Sunday morning between midnight and 4:00 am so it is a great time for a schedualed reboot.
Then we can clear up the backlog of updates requiering a reboot. - Jalapenoringe Nov 14, 2012 at 08:07pm
I would like to point out how insecure this approach is because the password is in clear text in the registry.
I would like to recommend LogonExpert at http://www.logonexpert.com/
- Pimientophillipmcturner Jul 23, 2013 at 01:28am
is there any way to force your server to reboot based on a trigger? if (xxy) stops responding, then (reboot)?
- TabascoRumRaisin Sep 9, 2013 at 05:21pm
Yes, this is possible, however only for Windows Server 2008. Open the task scheduler, and select a task to modify or create a new one under the tiggers tab. You can trigger an event based off of an event log.
- AnaheimPolarPeter Dec 4, 2013 at 04:37pm
The Server is shutting down but it has a 'You can now recycle the power' screen and doesn't actually shutdown completely, therefore doesn't reboot.
How can one bypass that screen?
I am using. shutdown.exe -r -f -t 01 - AnaheimPolarPeter Dec 4, 2013 at 08:54pm
Never mind.
I used pstools and psshutdown -r works for me. - Thai PepperAdamM1968 Sep 13, 2016 at 03:00pm
Thanks for this..it really has helped cut down on my weekly reboots. Works great.
- PimientoAleksey120 Nov 8, 2017 at 02:23pm
I wrote this simple PS script. Works on 2008+
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true,HelpMessage='RestartDate Format: dd-MM-yyyy HH:mm')]
[ValidateScript({[DateTime]::ParseExact($_, 'dd-MM-yyyy HH:mm', $null)})]
$RestartDate,
[Parameter(Mandatory=$true)]
[string]$Reason
)$now = get-date
$PostponeTo = get-date($RestartDate)
$secToRestartTimeFromNow = $PostponeTo - $now$sec = [math]::round($secToRestartTimeFromNow.TotalSeconds)
$cmd = 'shutdown /r /t $sec /d P:0:0 /c '$reason'Write-Host 'Running:'
$cmd
Invoke-Expression -Command $cmd -Verbose
Write-Host
Write-Host 'Use following command to cancel: '
Write-Host 'shutdown /a' - Cayennesalsamanp Jul 18, 2018 at 05:37pm
Hmm, this is a better method than what I've used in the past.
We created a batch file with the same shutdown command and switches and would run the batch file instead. Never thought of executing the shutdown command with the appropriate switches in the Run line of the scheduled task.
In our instance we copied the batch file to a utility folder on each server then we'd create the scheduled task. I'm guessing with this method that you can export the scheduled task and then import it to other servers without having to copy any thing else.
I like it. Thank you - PimientoRoger6940 Jul 30, 2018 at 01:26am
Thanks Scott. Simple and works great.
The only person that can directly logon the server (in our case) is the Admin so they are the only one that can access the registry so I don't see where the security issue is that was mentioned earlier. - AnaheimSandor7340 Apr 30, 2019 at 06:39pm
One slight adjustment needed for 2016 and 2019
The arguments now go into a separate box just below the Program/script box next to Add arguments optional.