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.
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
These may help you to do your back ups...
http://www.filedudes.com/files/Backup_Batch_File.html
Please post back if you have any more problems or questions.
See how you go with this
This batch file will do a full Backup the first time that it is run and an incremental Backup afterwards.
Set up a Drive Letter for the Drives. Connect the Drive you are going to use for the Backup. Right click on My Computer, select manage, and then click ?Disk Management.?
Change the drive letter of the drive. Right-click on the drive in the list, and from the resulting menu select 'Change Drive Letters and Paths' Click on Change so you can change the drive letter. Click Change.
Select a new drive letter from the drop down list, preferably the one that is not normally used for this drive. EG: U:
If the USB Drives are identical it should allocate the same drive letter.
You can then copy this batch file to the Drive and run it from there. To automate it use the TaskShedular.
munexbck.cmd
@echo off
:: variables
set path=%~dp0Backup;%path%
set drive=%~dp0Backup
set backupcmd=xcopy /s /c /d /e /h /i /r /k /y
if not exist '%drive%Backup' mkdir '%drive%Backup'
if not exist '%drive%munex' mkdir '%drive%munex'
%backupcmd% 'C:munex' '%drive%munex'
< format >
Microsoft Server 2003 Backup
Or Robocopy
If you want more functions then XCopy use robocopy.
eg (from Wikipedia)
/MIR
Activates mirror mode, deleting any files in the destination that are not present in the source (equivalent to /E and /PURGE).
/Z
Copy files in restartable mode. 'Restartable' means Robocopy should write a recovery record inside an incomplete file so if the operation is interrupted or aborted, a future run of Robocopy can resume copying where the previous one left off, instead of starting over at the beginning. This is useful for reliably copying large files or many files over an unreliable network such as a VPN or the Internet. An incomplete file has the same file size as the complete file, and is noted with a date stamp in the file system being within 24 hours of 1980-01-01 00:00
you can get robocopy from Microsoft Windows Server 2003 Resource Kit Tools
http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en
Post if you need help writing the script, I have done a few Robocopy scripts.
Also here is a link to Wiki with all the switches
http://en.wikipedia.org/wiki/Robocopy