Tech Support Forum banner

writing a script

1396 Views 0 Replies 1 Participant Last post by  dvsyvonne
Hi,

I just had get a new server in for my company and I am now needing to get my old scripts that I have to work on the new computer.

This is the old scripts. every time I try to run it I get this error.

Script: C:\IT\Scripts\Backup_Lunch.vbs
Line: 103
Char: 2
Error: The system cannot find the file specified.

Code: 80070002
Source: WshShell.Exec

REM 04 Aug 2006 - RFimbres - Modified to exclude this file: \\goliath\c$\Documents and Settings\rkim\My Documents\Outlook Backup\Backup Outlook PST File.bkf

REM 03 Aug 2006 - RFimbres - Modified to exclude AVI files
REM Also modified to exlude this folder and it subfolders: \\cyclops\c$\documents and settings\atorres\My Documents\MISC\Personal

REM 27 Apr, 2006 - RFimbres - Changed backup location from \\tux to \\howard
REM Also added "/SEC" to allow copying of security information and removed "/S", which is not used with "/MIR"

REM Mar 7, 2006 - APerlovich - Changed location from \\hulk1 to \\tux
REM Mar 1, 2006 - APerlovich - Changed location from \\xander to \\hulk1
REM Oct 28, 2005 - RFimbres - Moved location of scripts to c:\it\scripts and logs to c:\it\logs\backuplogfiles on \\xander
REM Oct 28, 2005 - APerlovich - Set backups to all to go a single folder instead of each weekday
REM May 20, 2005 - APerlovich - Changed backup server from \\gambit to \\xander

REM Sep 1, 2004 - RFimbres
REM Added sleep command to pause between backups
REM Added back code to write to log when ping fails -- NOTE: Code NOT working yet
REM Removed "On Error Resume Next" statement

REM August 24, 2004 - RFimbres
REM Removed code to write to log file when ping fails -- was causing an endless loop

REM Updated August 21, 2004 - RFimbres
REM Changed Robocopy logs to point to individual user names

REM Updated August 20, 2004 - RFimbres
REM Modified to include individual user backup CMD files in this script
REM Previously CMD files were separate files & called by this script
REM Also modified to check for day of the week and copy backups to appropriate folder on backup server
REM based on that day
REM Also modified backup server & share to be a variable rather than a fixed name
REM Backup logs folder also modified to be a variable rather than a fixed name

REM Updated July 27, 2004 - RFimbres
REM Modified individual user backup files to exclude these file types: *.rmj *.mp3 *.wma
REM Current exceptions are MAnthony and RAnthony, both of whom do NOT have the *.mp3 or *.wma files excluded

REM Updated Dec. 3, 2003 - RFimbres
REM Added outputting to log file when system is not connected to the network

REM Created Dec. 1, 2003 - RFimbres
REM Performs back up from server, pulling files from clients using Robocopy
REM Only changed files are copied; files that no longer exist in the source are deleted

REM Next line ensures script continues in event of error
REM//////\\\\\\\On Error Resume Next

REM Set variable for pinging systems & running command files
Set objShell = WScript.CreateObject("WScript.Shell")

REM Set variables for logging systems not connected
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")

REM Set name of backup server
BackupServer = "howard\userbackups\"

REM Set location of backup logs folder
BackupLogsFolder = "c:\it\logs\BackupLogFiles"

REM Obtains current day of week in numeric form -- 1 = Sunday, 2 = Monday, etc.
REM CurrentDayOfWeek = DatePart("w", Date)

REM Based on day of week, sets value of "CDOW" (current day of week) variable to text
REM Select Case CurrentDayOfWeek
REM Case 1
REM CDOW = "Sunday"
REM Case 2
REM CDOW = "Monday"
REM Case 3
REM CDOW = "Tuesday"
REM Case 4
REM CDOW = "Wednesday"
REM Case 5
REM CDOW = "Thursday"
REM Case 6
REM CDOW = "Friday"
REM Case 7
REM CDOW = "Saturday"
REM End Select

REM Actual routine for backing up user systems
REM Start by pinging system to see if it's connected on the network
REM If system is not connected, exit
REM If system is connected, run user's individual backup command script

Set objFSO = CreateObject("Scripting.FileSystemObject")
REM Opened for reading
Set objFile = objFSO.OpenTextFile("c:\it\scripts\UserAndComputerNames-Lunch.txt", 1)

REM Read in user and system names
Do Until objFile.AtEndOfStream
User_Name = objFile.ReadLine
System_Name = objFile.Readline
REM Ping to see if system is on the network
Set objExecObject = objShell.Exec("cmd /c ping -n 1 -w 50 " & System_Name)
REM Read results of ping
Do While Not objExecObject.StdOut.AtEndOfStream
strText = objExecObject.StdOut.ReadLine()
REM If ping is successful, run backup job
If Instr(strText, "Reply") > 0 Then
REM Runs backup command, placing files in appropriate folder set based on day of the week
Set objExecObject = objShell.Exec("robocopy.exe ""\\" & System_Name & "\c$\documents and settings\" & User_Name & """ \\" & BackupServer & User_Name & "\profile /MIR /SEC /XA:SH /XF *.avi *.mpg *.rmx *.rmj *.mp3 *.wma *.m4a outlook.pst outlook1.pst *.TMP ~*.* *.lnk /XD History.IE5 \\goliath\c$\Documents and Settings\rkim\My Documents\Outlook Backup \\cyclops\c$\documents and settings\atorres\my documents\misc\personal ""\\" & System_Name & "\c$\documents and settings\" & User_Name & "\My Documents\My Pictures"" ""\\" & System_Name & "\c$\documents and settings\" & User_Name & "\cookies"" ""\\" & System_Name & "\c$\documents and settings\" & User_Name & "\Local Settings\Temporary Internet Files"" ""\\" & System_Name & "\c$\documents and settings\" & User_Name & "\Local Settings\Temp"" /R:1 /W:1 /LOG+:" & BackupLogsFolder & "\" & User_Name & "backup_log.txt")
REM Sleep for 90 seconds to allow backup to run
WScript.Sleep 90000
REM If ping fails, write message to log
Elseif Instr(strText, "timed out") > 0 Then
Set objFile2 = objFSO.OpenTextFile("c:\it\logs\BackupLogFiles\PCsNotConnected_log.txt", 8)
ObjFile2.WriteLine Now
ObjFile2.WriteLine "\\" & System_Name & " not contacted"
ObjFile2.Close
Elseif Instr(strText, "could not find") > 0 Then
Set objFile3 = objFSO.OpenTextFile("c:\it\logs\BackupLogFiles\PCsNotConnected_log.txt", 8)
ObjFile3.WriteLine Now
ObjFile3.WriteLine "\\" & System_Name & " not contacted"
ObjFile3.Close
End If
Loop
Loop
objFile.Close

Please help me out on this scripts.

This scripts is ment to back up my users profile on to a portable hard drive on another server then that hard drives get backup on to a tape drive at nigth thur Symantec Back Exec 10d.

please really need your help new to this scripting thing.

Thanks.

Yvonne Mejias
[email protected]
See less See more
Status
Not open for further replies.
1 - 1 of 1 Posts
1 - 1 of 1 Posts
Status
Not open for further replies.
Top