I have a set of Robocopy scripts that I have been using on server 2003 for a couple of years quite successfully. Now I am trying to use these same scripts to do the same job from server 2008 R2 and they keep hanging up. Here is what they need to do:
I use the Task Scheduler to kick of a script each night that starts my process. The process is that Robocopy will collect files from a source PC and copy them to the destination storage on the server. Then it calls another script that uses a findstr and a txt to generate an output log file that is a summary of the log file created in the copy process. Then it starts a RoboEmail.vbs command that sends the summary log in an email to the designated email address.
When I manually run the script everything works fine. When I run the script through the Task Scheduler the process goes through to sending the email then only sends the first four but will not send the rest. I see the summary logs created and in the Task Manager I see all the processes start and end but the emails do not go through.
The account that I run the script with has full Domain Admin rights and works fine when manually started but that is with my creds at that point. I am including the scripts below
This is what the Task Scheduler starts:
Title Lab Backup
@echo off
REM This script is to start the backup process.
REM It need to have the path to the backup script the instrument name and the share name
rem Source
Inst Share Lab
Start C:\Source\Scripts\Instruments\INSBU.cmd PC395 CHEM32 Denver
Start C:\Source\Scripts\Instruments\INSBU.cmd PC342 HPCHEM Denver
Start C:\Source\Scripts\Instruments\INSBU.cmd PC306 CHEM32 Denver
Generally have 10 to 15 Starts here
This is INSBU.cmd that the above script starts:
Title Instrument Backup
@echo off
REM Written by Me to run instrument backups
REM Set Variables that are passed from the BU script that calls this script
set SDIR=c:\Source\Scripts
set INST=%1
set PTH=%2
set LAB=%3
SET SRC=\\%INST%\%PTH%
REM The destination drive may vary from server to server
SET DES=D:\Instrument_Data\Backups\%INST%\%PTH%
SET LOG=c:\Source\Scripts\Logs\%INST%.log
SET LOGOUT=c:\Source\Scripts\Logs\%INST%output.log
echo Instrument= %INST%
echo Path=%PTH%
echo Lab= %LAB%
echo Logout= %LOGOUT%
echo Source= %SRC%
echo Destination= %DES%
echo Log= %LOG%
Title %INST%
REM Run the backup script
cd c:\source\scripts\Instruments
Robocopy "%SRC%" "%DES%" /NP /FFT /Z /S /V /TEE /IPG:5 /R:5 /W:5 /XO /Log:"%LOG%"
REM This captures the errorlevel so that it can be reported in the email
set ERR=%errorlevel%
echo %LOGOUT%
REM Switch to the Logs folder and collect the summary results for the backup
cd c:\source\scripts\logs
call c:\source\scripts\logs\Results.cmd %INST%
echo %INST%
REM Send email to group indicated with the results of the backup and the error code that is generated
cd c:\source\scripts
START /MIN C:\Source\scripts\RoboEmail.vbs "%LAB%-InstBackupNotification@DOMAIN.com" "%LAB% %INST% backup log" "%LOGOUT%" %ERR%
Exit
This is the Results.cmd call out to generate the summary from above
@ECHO on
REM This script captures the summary information at the bottom of the log file
REM and creates a new file to be attached to the email sent to the lab with results
REM The variables are sent from the backup script
REM Set Variables
set RSYS=%*
echo %RSYS%
findstr /G:finddata.txt %RSYS%.log > %RSYS%output.log
exit
This is the RoboMail.vbs to send the email to the intended destination
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).
Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM
Set objMessage = CreateObject("CDO.Message")
objMessage.From = "Backup@testamericainc.com"
objMessage.To = WScript.Arguments.Item(0)
objMessage.Subject = WScript.Arguments.Item(1) & " Error Code = " & WScript.Arguments.Item(3)
objMessage.TextBody = "Facility backup log attached. Error codes listed below" & vbCrLf & vbCrLf
objMessage.TextBody = objMessage.TextBody & "The attached log is a summary of the backup. The Detail log for this process may be too large to be emailed." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "You can Manually check the logs at \\SVR01\logs" & vbCrLf &vbCrLf
objMessage.TextBody = objMessage.TextBody & "Current Error Code = " & WScript.Arguments.Item(3) & vbCrLf & vbCrLf
objMessage.TextBody = objMessage.TextBody & "0 = No files changed" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "1 = Successful copy" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "2 = Extra files, check log for details" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "3 = Everything Copied Correctly but Extra files were on the Destination" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "4 = Mismatch files or directories, check log for errors" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "8 = Some files or directories could not be copied" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "16 = Serious Error - Action Required" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "Most of the time error 16 means that the computer was not accessible." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "This needs to be verified that the PC on. Reboot if needed." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "If this does not correct the issue then open a helpdesk" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "Category: IT Use Only Subcategory: ComVault Item: Backup" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "and list in the ticket the information then it will be looked into further" & vbCrLf
objMessage.Addattachment WScript.Arguments.Item(2)
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "10.1.###.###"
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2
'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "domain\username"
'Your password on the SMTP server
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
'Server port (typically 25)
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send
This has been a thing of beauty for the last couple of years and has been serving me very well until trying to get it to work on server 2008. Can anyone see anything I am missing?
Thank you
Virgil :}{:
- Edited by TA-ITAdmin Friday, December 05, 2014 5:36 PM