Link to home
Create AccountLog in
Avatar of jonathanduane2010
jonathanduane2010

asked on

VB Programming and problems on startup and Login

Hi,

I have a system that copies files depending on whether the vpn connection is up or  not, and when the machine starts i run the following script (manually) which runs other scripts and batch files in the directory and they all run fine. (its called run.vbs)

On Error Resume Next
dim WshShell

set WshShell = CreateObject("WScript.Shell")


WshShell.Run "wscript.exe UTVCopyfilesfromserver.vbs", 2, FALSE
WScript.Sleep 3000
WshShell.Run "wscript.exe irnCopyfilesfromservertext.vbs", 2, FALSE
WScript.Sleep 3000
WshShell.Run "wscript.exe utvnewsaudioconversion.vbs", 2, FALSE
WScript.Sleep 3000
WshShell.Run "wscript.exe irnnewsaudioconversion.vbs", 2, FALSE
WScript.Sleep 3000
WshShell.Run "wscript.exe UTVscriptexttonews.vbs", 2, FALSE
WScript.sleep 3000
WshShell.Run "wscript.exe irnscriptexttonews.vbs", 2, FALSE
WScript.Sleep 3000
WshShell.Run "wscript.exe irnCopyfilesfromserveraudio.vbs", 2, FALSE
WScript.Sleep 3000

WshShell.Run "cmd.exe /c copytoirnboxirntxt.bat", 2, FALSE
WshShell.Run "cmd.exe /c copytoirnboxutvaudio.bat", 2, FALSE
WshShell.Run "cmd.exe /c copytoirnboxutvtext.bat", 2, FALSE
WshShell.Run "cmd.exe /c irnaudiorobocopy.bat", 2, FALSE


But if the vpn connection goes down the machine restarts and i then i have a batch file that runs the run.vbs file and its called runf.bat and this is it

cd /D "%~dp0"
cscript run.vbs %*

But whenever the batch file runs on login (windows logs in automatically) the run.vbs runs but the scripts inside don't seem to run properly

Is there a program or something i can do to make sure they all run fine when machine restarts unattended.

also the reason i have it running as a batch file is because i can then tell that the scripts are running by being able to see the black boxes
SOLUTION
Avatar of Bradley Fox
Bradley Fox
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of jonathanduane2010
jonathanduane2010

ASKER

If i put it into user config within a group policy then if someone remotely connects to the machine they wont be able to tell if the scripts are running or not isnt that correct?

and if so is there anyway of telling if they will?
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.