Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Help with Auto Backup Script

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,61312
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Help with Auto Backup Script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Help with Auto Backup Script - 6/12/2008 3:39:37 AM   
  soze

 

Posts: 6
Score: 0
Joined: 5/30/2008
Status: offline
Trying to do an automatic backup when USB drive is plugged in, I'm using autorun to call the script but it doesn't seem to working.
Option ExplicitDim objFSO:     Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objShell:   Set objShell = CreateObject("Wscript.Shell")
Dim colDrives:  Set colDrives = objFSO.Drives
Dim drive
Dim drvbackup
Dim errReturnFor each drive in colDrives
   If objFSO.FileExists(drive & "\Autobackup.cmd") Then
       If Instr(1,drive,":\",1)>0 Then
           drvBackup = drive
           Exit For
       ElseIf Instr(1,drive,":",1)>0 Then
           drvBackup = drive & "\"
           Exit For
       Else
           drvBackup = drive & ":\"
           Exit For
       End If
   End If
NextIf drvBackup = "" Then
   msgbox "Cannot locate Autobackup.cmd on any of the drives attached to this computer"
   wscript.quit 3
Else
   errReturn = objShell.Run("robocopy.exe C:\ " & drvBackup & "BackupFolder /E /V /NP /ZB /R:3 /W:1",1,1)
   If errReturn <> 0 Then
       msgbox "Backup completed with the following error: " & errReturn
   Else
       msgbox "Backup completed successfully!"
   End If
End Ifwscript.quit 0
 
 
Post #: 1
 
 RE: Help with Auto Backup Script - 6/12/2008 7:22:59 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
What isn't working? Do you get an error? Is so, what is the error? What line specifically errors? Does anything happen? Does nothing happen?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to soze)
 
 
Post #: 2
 
 RE: Help with Auto Backup Script - 6/13/2008 4:48:50 AM   
  soze

 

Posts: 6
Score: 0
Joined: 5/30/2008
Status: offline
The error was being caused by the robocopy switches.

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Help with Auto Backup Script - 6/16/2008 12:00:50 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
So figure out what the switches need to look like first.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to soze)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Help with Auto Backup Script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts