Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Startup script doesn't work, works when run as local administrator

Status
Not open for further replies.

kwondra34

IS-IT--Management
Apr 25, 2008
6
US
Hey, The code below works just fine as local administrator. its for an application that has no silent/unattended install switches... when logged in as local administrator it works just fine as said before, but when run as a startup script it errors out, it was too quick to read it and i can not test it from here, but can someone substitue there own short installer and run it as a startup script and see if your thrown an error.

or if its blatant, whats wrong with my code, here it is:

Set oShell = CreateObject("WScript.Shell")
Set oNetwork = CreateObject("WScript.Network")

' ///////////////////////////////////////////////////////////////////////////////////////////////////
' Forcing the script to be run in CScript (This is not my code)
' ///////////////////////////////////////////////////////////////////////////////////////////////////

If InStr(1, WScript.FullName, "CScript", vbTextCompare) = 0 Then
oShell.Run "cscript """ & WScript.ScriptFullName & """", 1, False
WScript.Quit
End If

' ///////////////////////////////////////////////////////////////////////////////////////////////////
' Mapping Source and beginning install from \\triton
' ///////////////////////////////////////////////////////////////////////////////////////////////////


installerOne = "V:\400-501Simulator\SETUP.EXE"
installerTwo = "V:\500-601\SETUP.EXE"

oShell.Run("net use V: \\triton\Apps\Garmin /USER:domain\username password")

WScript.Echo "Mapping the install source..." & vbCrLf & vbCrLf
WScript.Sleep 4000
WScript.Echo "Installing 400-501Simulator... Will continue to next app shortly."
oShell.Run(installerOne)
WScript.Sleep 9000
oShell.SendKeys "%N"
WScript.Sleep 1000
oShell.SendKeys "%Y"
WScript.Sleep 1000
oShell.SendKeys "%N"
WScript.Sleep 1000
oShell.SendKeys "%N"
WScript.Sleep 29000
WScript.Echo "Installing 400-501Simulator... Will wait 25 seconds before proceeding."
oShell.SendKeys "%{F4}"
WScript.Sleep 2000
oShell.SendKeys " "
WScript.Sleep 2000

' 400-501Simulator Installed

WScript.Echo "Installing 500-601Simulator..."
oShell.Run(installerTwo)
WScript.Sleep 9000
oShell.SendKeys "%N"
WScript.Sleep 1000
oShell.SendKeys "%Y"
WScript.Sleep 1000
oShell.SendKeys "%N"
WScript.Sleep 1000
oShell.SendKeys "%N"
WScript.Sleep 29000
WScript.Echo "Installing 500-601Simulator... Will wait 25 seconds before proceeding."
oShell.SendKeys "%{F4}"
WScript.Sleep 2000
oShell.SendKeys " "
WScript.Sleep 2000

I tryed the WSH method of mapping the drive but got the same result. I used a real username and pass of course.

Ideas? I know this is a bad description but my brain is blown, maybe ill come back and clarify.. its also attached.
 
My knee-jerk reaction is that the System account, under which a startup script is run, does not have a desktop. So your SendKeys commands are not able to interact with the setup application.

Is it possible to silently install these packages? Maybe you need to look into InstallShield or Wise to repackage the applications.

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Hmm, it works as a login script which would possible prove your theory..

what about a oShell.RunAs /user:administrator "explorer.exe" and then executing it? or perhaps just a wmi query to start explorer early and then kill it before proceeding.

Going to try a few things and let you know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top