Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > RE: VB script does not run under scheduled task for mapped network dri

Reply
Thread Tools Display Modes

RE: VB script does not run under scheduled task for mapped network dri

 
 
jford
Guest
Posts: n/a

 
      11-06-2009
It works, but possibly Pegasus can correct my bad scripting habits

@echo off

set loc1="C:\Program Files\Microsoft Office\Office11\OIS.exe"
set loc2="C:\Program Files\Microsoft Office\Office12\OIS.exe"
set loc3="C:\program files\Microsoft Office\ART\Office12\OIS.exe"

if exist %loc1% (
call :regadd %loc1%
)
if exist %loc2% (
call :regadd %loc2%
)
if exist %loc3% (
call :regadd %loc3%
)
goto end
:regadd
reg add <keyname> /v <valuename> /d %1
:end

"JAW" wrote:

> I have a script that at the end must copy a file from one server to
> another server.
>
> I mapped a network drive via NET USE and saved the credentials and it
> works great!
>
> However, when I run the job (using the same account) as a scheduled
> task the copy fails. It works fine on a local drive but not on a
> networked driver. I get a 76 return code from the the copy.
>
> Below is the area of the code that fails.
>
> ' FTP good backup copy and check for success
>
> Const OverwriteExisting = TRUE
> objFSO.CopyFile v_backup,v_xbackup,OverwriteExisting
> objFSO.CopyFile v_output,v_xoutput,OverwriteExisting
>
> v_returncode = err.number
>
> If v_Returncode = 0 then
> WScript.echo "FTP return code =" & v_ReturnCode
> Else
> WScript.echo "FTP return code =" & v_ReturnCode
> WScript.echo "FTP command errored out"
> Call emailer
> v_msg = "Process Completed: " & time
> WScript.Echo v_msg
> Wscript.Quit 1
> End If
> .
>

 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a

 
      11-06-2009

The OP's post dealt with the question of using a scheduled task to copy some
files from here to there. Your response deals with a registry hack. I am
unable to see any connection between the two.


"jford" <> wrote in message
news:F9FC7D52-CE94-487A-8F48-...
> It works, but possibly Pegasus can correct my bad scripting habits
>
> @echo off
>
> set loc1="C:\Program Files\Microsoft Office\Office11\OIS.exe"
> set loc2="C:\Program Files\Microsoft Office\Office12\OIS.exe"
> set loc3="C:\program files\Microsoft Office\ART\Office12\OIS.exe"
>
> if exist %loc1% (
> call :regadd %loc1%
> )
> if exist %loc2% (
> call :regadd %loc2%
> )
> if exist %loc3% (
> call :regadd %loc3%
> )
> goto end
> :regadd
> reg add <keyname> /v <valuename> /d %1
> :end
>
> "JAW" wrote:
>
>> I have a script that at the end must copy a file from one server to
>> another server.
>>
>> I mapped a network drive via NET USE and saved the credentials and it
>> works great!
>>
>> However, when I run the job (using the same account) as a scheduled
>> task the copy fails. It works fine on a local drive but not on a
>> networked driver. I get a 76 return code from the the copy.
>>
>> Below is the area of the code that fails.
>>
>> ' FTP good backup copy and check for success
>>
>> Const OverwriteExisting = TRUE
>> objFSO.CopyFile v_backup,v_xbackup,OverwriteExisting
>> objFSO.CopyFile v_output,v_xoutput,OverwriteExisting
>>
>> v_returncode = err.number
>>
>> If v_Returncode = 0 then
>> WScript.echo "FTP return code =" & v_ReturnCode
>> Else
>> WScript.echo "FTP return code =" & v_ReturnCode
>> WScript.echo "FTP command errored out"
>> Call emailer
>> v_msg = "Process Completed: " & time
>> WScript.Echo v_msg
>> Wscript.Quit 1
>> End If
>> .
>>



 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: VB script does not run under scheduled task for mapped network drive Pegasus [MVP] Scripting 0 11-04-2009 06:01 PM
Problem setting up scheduled task Mike B Windows Vista Administration 2 01-11-2008 03:09 PM
Missing scheduled task? SonicJoe Windows Vista Performance 6 11-07-2007 06:48 PM
Can't display or change a task with schtasks.exe clayga Windows Vista Administration 0 08-03-2007 06:16 PM
Simple scheduled task won't run - no matter what ! Paul Windows Vista Performance 10 07-10-2007 09:31 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59