#57402 - 2001-07-19 09:29 PM
run program silently through logon script
|
Anonymous
Anonymous
Unregistered
|
HI there, I would like to install a program that needs to be installed on all the machines on the corporate network. I have successfully run kixtart on my network with windows 9X, NT and 2000 professional. I was wondering how I could run a program silently without user intervention. Then if the program(or upgrade) is already installed, it will not install it again? Can anyone give me a sample script that I can work with? Thanks alot. I hope you can help me ASAP.
|
Top
|
|
|
|
#57404 - 2001-07-20 12:16 AM
Re: run program silently through logon script
|
Anonymous
Anonymous
Unregistered
|
Thanks for the help LL, I'll see what I can do to change my kix. Also, the setup.exe I want to run doesn't provide an option to to be run on dos mode. It just kicks the program then I have to do it manually.
|
Top
|
|
|
|
#57406 - 2001-07-20 04:45 AM
Re: run program silently through logon script
|
Anonymous
Anonymous
Unregistered
|
hi LL, I didn't realize you can search for switches while opening it on wordpad. Thanks for the info! I was referring to running it on dos mode to search for switches like: /? /R etc... I tried that and didn't get any input but rather, it ran the program automatically on gui and ask me to click "next" to run the program.What do you mean by this? quote: If you can't get a silent install, look to using setfocus() and sendkeys() to move the install along.
Can you give me more info on how to implement this? because I have a doubtful mind I won't be able to run this setup.exe executable silently/automatically otherwise. Thanks a bunch for the infos... -Jimmy
|
Top
|
|
|
|
#57407 - 2001-07-20 06:48 AM
Re: run program silently through logon script
|
Les
KiX Master
Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
|
Don't mean to be rude but you gots to RTFM. SetFocus() caan be used to bring a GUI window into focus or to check to see if the windows exists.If SetFocus ("Untitled - Notepad") = 0 ;Notepad in memory If SetFocus ("Untitled - Notepad") <> 0 ; Notepad not in memory SendKeys() will stuff characters to the window you just setfocus to. Here's a sample from the manual:
code:
Run "notepad.exe" SetFocus( "Untitled – Notepad" ) $ReturnCode = SendKeys("Hello World") Sleep( 2 ) $ReturnCode = SendKeys("~{F4}Y")
It's not perfect. Users can break it. Throw up message boxes to let them know what's happening. Here's a sample from one of my scripts:
code:
MessageBox("NOTICE!" + Chr(13) + "LANDesk Virus Protect must first be uninstalled." + Chr(13) + "System must REBOOT when complete!" + Chr(13) + "Choose Yes to uninstall and Yes to reboot" + Chr(13) + "on the two options that follow","Norton AntiVirus 7.5 Install",48,60) RUN "C:\Program Files\LANDesk\VP5\vpremove.exe" goto finish endif RUN "C:\Program Files\LANDesk\VP5\vpremove.exe" sleep( 1 ) setfocus("Uninstall Message") sendkeys({ENTER}) sleep( 15 ) setfocus("Uninstall Message") sendkeys({ENTER}) endif
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.
|
Top
|
|
|
|
#57410 - 2001-07-20 04:21 PM
Re: run program silently through logon script
|
Anonymous
Anonymous
Unregistered
|
Hey, I think I will use MCA's uninstall flag because i'm actually doing an upgrade of a software that needs to be installed. I'm not doing a full install. But I'll use LL's registry check on future software installs.LL, thanks for your input about sendkeys and setfocus. Man, i didn't even know they existed! Thanks a bunch guys! Hope it works... -Jimmy
|
Top
|
|
|
|
#57411 - 2001-07-20 05:19 PM
Re: run program silently through logon script
|
Anonymous
Anonymous
Unregistered
|
One of the best ways to do silent installs is to repackage the application. Windows 2000 comes with Veritas Winstall LE which you can use to port almost any application over to MSI format. Once in MSI format, the application can be installed silently by calling it with msiexec with the /i /q switches. The other nice thing about MSI deployment is on successive runs, you can use other switches to reinstall any changed files, reinstall the whole program if any files have changed... etc etc. Forthermore, if you ever get to a homogenous 2000 network with active directory, you can use the MSI files to publish the application using Group Policy. Search the MS site for more info on MSI deployment. It is a very elegant way of installing applications and enforcing changes onto machines.
|
Top
|
|
|
|
#57412 - 2001-07-20 05:53 PM
Re: run program silently through logon script
|
Anonymous
Anonymous
Unregistered
|
to, thanks for that advice. I'm sure there are lots of things that can be done out there, I'm just not sure which one will be easier and faster to setup. I'm already doing what MCA and LL suggested. I'll probably research on MSI later. Since we have homogenous networks (9X, NT, 2000) I don't have the time to install an MSI program on each machine yet just to support the MSI platform. I'll probably place the msi executables on kix then once that is done, I could just use MSI to do software updates.Another question I have is that I can't seem to make the setfocus and sendkeys to work: Here is my code:
code:
$linxlog="c:\install001.ok" IF (Exist($linxlog) = 0) Shell( “setup.exe” ) sleep( 2 ) SetFocus( “Lan” ) SendKeys("{ENTER}” ;) Sleep( 1 ) SetFocus( "Type of Installation" ) SendKeys("{DOWN}” ;) Sleep( 1 ) SetFocus( "Lan" ) SendKeys("{ENTER 3}” ;) Sleep( 10 ) SetFocus( “Telephony” ) SendKeys("~O” ;) SetFocus( "Lan" ) SendKeys("{ENTER}” ;) ; - script completed. result $linxlog will be created. IF (WriteProfileString($linxlog,"install",@userid,@date+" "+@time) <> 0) ENDIF ELSE $info=ReadProfileString($linxlog,"install",@userid) ? "Informative INSTALL: software already installed at "+$info ENDIF
It gives me an error on the second setfocus saying that: quote:
1407Script error : error in parameter(s) !. SetFocus( "Type of Installation" )
I hope when this set focus is fixed, I'd like to know if the rest of the code will work. Thanks. -Jimmy [ 20 July 2001: Message edited by: jvd626 ]
|
Top
|
|
|
|
#57413 - 2001-07-20 06:17 PM
Re: run program silently through logon script
|
Anonymous
Anonymous
Unregistered
|
I think I know what the problem is. My cut and paste wasn't in the right format. I realized it as I was posting the code in my last post. It made smiley faces I changed it to be pure ansi. However, another problem aroused... It keeps giving me this input on NT/2000: quote: Please go to the Control Panel to Install and configure system components. (OK)
Also after saying (ok), while executing the script, it gives out these numbers four by four from left to right: quote:
14070 14070 14070...etc.
It doesn't even install the program once its finished, however it creates a install file on C: drive... Please help!
|
Top
|
|
|
|
#57414 - 2001-07-20 09:45 PM
Re: run program silently through logon script
|
Les
KiX Master
Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
|
Without the benefit of having the program you're trying to install, it's tough. Sounds like you need to test for OS and write separate code for each. Also for NT/2K need to check for permissions. Here's a sample:
code:
; check OS WinNT = 1, Win95 = 2 ; if @INWIN = 2 goto OSRightsOK endif ;----------------------------------------------------------------------------------- ;must not be Win95, therefor must be WinNT so more checks are in order ;----------------------------------------------------------------------------------- ; check if logon to Server or Workstation ;PRODUCTTYPE - WinNT = Workstation, ServerNT = Member Server, LanmanNT = Domain Controller ; $PRODUCTTYPE = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\PRODUCTOPTIONS","PRODUCTTYPE") if $PRODUCTTYPE = "WinNT" goto NTwks endif ; ; if logon to server as non-admin, just exit without notice (for WTS users) else nag and exit ; if INGROUP ("Domain Admins") <> 2 goto finish beep $RC = MessageBox("NOTICE!" + Chr(13) + "YOU ARE LOGGED ON TO A SERVER, installation aborting!" + Chr(13),"ShowCase Strategy 3 Install",16,60) goto finish ENDIF ;----------------------------------------------------------------------------------- :NTwks ;----------------------------------------------------------------------------------- ; check if NT User has Local Admin rights ; if INGROUP ("\\" + @WKSTA + "\Administrators") = 2 goto OSRightsOK else beep $RC = MessageBox("NOTICE!" + Chr(13) + "Insufficient rights, installation aborting!" + Chr(13) + "Please notify the FF HelpDesk at ext. 1864","ShowCase Strategy 3 PTF O301120 Install",16,60) goto finish endif ;----------------------------------------------------------------------------------- :OSRightsOK
As far as the 14070 I suspect 1407 is error and/or result codes. To suppress the result code you can put a $RC (or $anything) in front of the function like this: $RC = setfocus (bla-bla-bla)The stuff between the quotes on setfocus() has to match each window exactly. Close doesn't count. It would also be good practice to use FlushKB to clear the buffer in case your users hit keys before your SendKeys(). Also, with SHELL, the script should wait. If it does, there's nothing to setfocus to. You may need to use RUN instead. That's the problem with using a file flag to test if installed. If your codes not rock solid, you could have a failed install and a set flag. If the install adds itself to add/remove, I prefer the registry check. If you're doing an upgrade, another thing you can do is to test the current version to determine if an upgrade is needed. Here's how I do that:
code:
if GetFileVersion($syspath + "\SCODBC32.DLL") = "3.01.120.122 (2001-05-10)" goto finish endif
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.
|
Top
|
|
|
|
#57415 - 2001-07-21 01:20 AM
Re: run program silently through logon script
|
Anonymous
Anonymous
Unregistered
|
Ok, it works now on 9X, NT, and 2000 but the problem concerns about their installation speed. Sometimes the sleep() runs out and the install ends up failing. Also, why is the user seeing the install process? Can it be hidden somewhat like running on the background or minimized?
|
Top
|
|
|
|
#57418 - 2001-07-21 06:10 PM
Re: run program silently through logon script
|
Anonymous
Anonymous
Unregistered
|
I'll try it on monday and see what happens. Thanks for the infos. Also, is there anybody who knows anything about MSI? I looked on microsoft website and they recommended not to put it on production because its still on its early stages. Anyway, it would be great to know anything that deals with automatic software installations and updates thats bullet proof.Also, would anyone show me how to make it so that users will be prompted first and say "ok," so they will know what is going on? Since I can't make it silently install, might as well give the users heads up what is happening first right? Here is an example: quote:
Your Phone software will be upgraded. Click [Enter] to continue...
[ 21 July 2001: Message edited by: jvd626 ]
|
Top
|
|
|
|
#57420 - 2001-07-23 05:19 PM
Re: run program silently through logon script
|
Anonymous
Anonymous
Unregistered
|
Regarding MSI deployment. I don't think this board is the place to talk about it since it is not exactly Kix related. Please feel free to ICQ me at 3534815 if you have any questions about MSI.
|
Top
|
|
|
|
#57421 - 2001-07-23 07:11 PM
Re: run program silently through logon script
|
Anonymous
Anonymous
Unregistered
|
hello, it is monday and I am still having difficulties with the script. it gets to the point where its installing the files but then, I think the setfocus runs out and it just doesn't finish the installation. The script doesn't wait for the program to finish. I tried setting a loop as follows:code:
While $RC = SetFocus( "Installing" ) <> 0 Sleep( 1 ) Loop SetFocus( "Telephony LAN-Linx Config" ) SendKeys("~O") Sleep( 3 ) SetFocus( "Lan-Linx 2000 Installation" ) SendKeys("{ENTER}")
Any ideas? THanks alot.
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 918 anonymous users online.
|
|
|