durex Posted November 25, 2004 Posted November 25, 2004 I couldnt get the silent installation to work for the life of me, so I tossed together this VBS Script. Adjust Installation Path and Setup locations appropriately...Dim FSO, WshShell, AllDrives, CDROM, SYSD, APPSet FSO = CreateObject("Scripting.FileSystemObject")Set AllDrives = FSO.DrivesSet WshShell = WScript.CreateObject("WScript.Shell")SYSD = WshShell.ExpandEnvironmentStrings("%Systemdrive%")' Check for CDROMFor Each Drive In AllDrives If Drive.DriveType = "4" Then If FSO.FileExists(Drive & "\WIN51") Then CDROM = Drive Exit For End If End IfNextIf Len(CDROM) = 0 Then WScript.QuitAPP = CDROM & "\Custom\Applications"'Launch InstallerWshShell.Run (APP & "\Diskeeper9\setup.exe")Do until WshShell.AppActivate ("Diskeeper Professional Edition") WScript.Sleep 2000LoopWScript.Sleep 1000' Hit N for NextWshShell.SendKeys "N"WScript.Sleep 500' Hit N for NextWshShell.SendKeys "N"WScript.Sleep 500' Hit a for acceptWshShell.SendKeys "a"WScript.Sleep 500' Hit N for NextWshShell.SendKeys "N"'WScript.Sleep 500' Hit C for ChangeWshShell.SendKeys "c"WScript.Sleep 500' Hit C for Change Installation Path WshShell.SendKeys "C:\Program Files\Utilities\Diskeeper"'WScript.Sleep 500' Hit Enter to Accept PathWshShell.SendKeys "{ENTER}"WScript.Sleep 500' Hit N for NextWshShell.SendKeys "N"WScript.Sleep 500' Hit I for InstallWshShell.SendKeys "I"Do until WshShell.AppActivate ("Product Registration") WScript.Sleep 2000LoopWScript.Sleep 1000'Hit Tab twice to cancel RegistrationWshShell.SendKeys "{TAB}"WshShell.SendKeys "{TAB}"WshShell.SendKeys "{ENTER}"Do until WshShell.AppActivate ("Cancel Registration?") WScript.Sleep 2000LoopWScript.Sleep 1000'Hit Tab once to never registerWshShell.SendKeys "{TAB}"WshShell.SendKeys "{ENTER}"WScript.Sleep 1500'Click Finish for installWshShell.SendKeys "{ENTER}"WScript.Quit
Astalavista Posted November 25, 2004 Posted November 25, 2004 REG ADD %Key%\040 /VE /D "Diskeeper 9" /fREG ADD %Key%\040 /V 1 /D "%CDROM%\Software\Diskeeper\DKsetup.exe /S /V/QN" /f
BritishBulldog Posted November 25, 2004 Posted November 25, 2004 try this cdrom detection script in vbs, its a bit shoerter and it also checks if the drive is ready..the last line is just for the demoset WshShell = WScript.CreateObject ("WScript.Shell")Set fso = CreateObject("Scripting.FileSystemObject")'finding CDROM drive letterFor Each objDrive In fso.Drives If objDrive.DriveType = "4" And objDrive.IsReady Then If fso.FileExists(objDrive & "\WIN51") Then cdrom = objDrive End IfNextWshShell.Popup "Your XPCD is in drive " & cdrom ,3,"Find CDROM in vbs"
durex Posted November 25, 2004 Author Posted November 25, 2004 @AstaI shoulda reworded what I said... that type of silent install works fine, but the "/r" didnt create a setup.iss and since Im wicked anal and hate installing all of my programs to Program Files, this was the only other way (that I knew of anyway) to install into a different directory.@BulldogThanks a bunch for the code.. always looking for ways to tighten it up.
BritishBulldog Posted November 25, 2004 Posted November 25, 2004 Hi durex (what a name )I do too, try and get as short a code as possible.another one i came across the other day was WshShell.SendKeys "{TAB 2}"WshShell.SendKeys "{ENTER 3}" which means hitting the tab twice and the ENTER 3 times. You should be able to use it with most of the SendKeys but be carefull with the ENTER.If you do actually need a short pause between them, best then to go back to listing them all seperate. This is best used with the TAB.
Astalavista Posted November 25, 2004 Posted November 25, 2004 ahh.. u want to install it on a different dir. i see
prathapml Posted November 25, 2004 Posted November 25, 2004 The problem with this, is that if you use this script on a PC that is especially slower than expected, it will not work properly (i.e., if expected dialog-boxes do not show up within 500 milli-seconds).If all you want is to change the folder to be installed to, just use the "INSTALLLOCATION=C:\Program Files\MyApp" property of the MSI installer, at command-line.Example:%systemdrive%\install\diskeeper9\admin-point.msi INSTALLLOCATION="C:\Program Files\Diskeeper" /QB
durex Posted November 25, 2004 Author Posted November 25, 2004 omg... Ive searched high and low for a parameter like this... if that works as it should ghead and remove this post, cause thats the only reason why I did this.Does that parameter work for all windows installer packages? If so, thx a ton pr...
prathapml Posted November 25, 2004 Posted November 25, 2004 omg... Ive searched high and low for a parameter like this...Well, sometimes the answer is so simple that we don't get it until after we have chosen a HUGE round-about way to do it. Happens to me too! Anyways, here's what you should do:0. The below is only to simplify things as far as using switches goes - you can use the setup.exe as it is, but I'd rather not use diskeeper's original installer.1. Run the original installer (according to your VBS, its "\Diskeeper9\setup.exe") with the "/A" switch, at command-line to have it install an Administrative Install Point (AIP).2. Then get to the folder where the AIP was created - it will normally be larger than the original installer was.3. Put that folder on your unattended CD or network-share. [optional : If you want it to occupy less space, compress it to RAR and make it an SFX (self-extracting silent archive). My diskeeper 9 archive is only 8.7 MB. ]4. Now, using your normal scripts, call the .MSI from that folder. If you use RunOnceEX or XPlode or any of the million methods, you might need to modify the example below (below is just a simple command-line/batch-file type of command to silent-install diskeeper to where you want it)%systemdrive%\install\diskeeper9\admin-point.msi INSTALLLOCATION="C:\Program Files\Utilities\Diskeeper" /QBIf you want to disable the "check for updates" that diskeeper does, when its started the first time, there's a registry tweak - just search in your registry for it.Yes, most MSI-based installers have this property. They even have a property to specify exactly where the shortcut to the app should be created, in your StartMenu!IMPORTANT notes about installlocation property:1. You need quotes around the path, *ONLY IF* your path has spaces (otherwise don't use quotes).2. The **** thing doesn't allow you to specify system variables (for example, you can't use INSTALLLOCATION=%ProgramFiles%\Utilities\Diskeeper).Hoping this helps.....
BritishBulldog Posted November 26, 2004 Posted November 26, 2004 This would also give a message box coming up for 3 seconds to tell you the CDROM was not found. Better than just quitting the vbs. If Len(CDROM) = 0 Then WshShell.popup "CDROM not found",3,"Diskeeper"WScript.QuitEnd if
durex Posted November 26, 2004 Author Posted November 26, 2004 Quick question.. whats the difference b/t using Wshell.Popup over MsgBox?
durex Posted November 27, 2004 Author Posted November 27, 2004 Anyways, here's what you should do:0. The below is only to simplify things as far as using switches goes - you can use the setup.exe as it is, but I'd rather not use diskeeper's original installer.1. Run the original installer (according to your VBS, its "\Diskeeper9\setup.exe") with the "/A" switch, at command-line to have it install an Administrative Install Point (AIP).2. Then get to the folder where the AIP was created - it will normally be larger than the original installer was.3. Put that folder on your unattended CD or network-share. [optional : If you want it to occupy less space, compress it to RAR and make it an SFX (self-extracting silent archive). My diskeeper 9 archive is only 8.7 MB. ]4. Now, using your normal scripts, call the .MSI from that folder. If you use RunOnceEX or XPlode or any of the million methods, you might need to modify the example below (below is just a simple command-line/batch-file type of command to silent-install diskeeper to where you want it)%systemdrive%\install\diskeeper9\admin-point.msi INSTALLLOCATION="C:\Program Files\Utilities\Diskeeper" /QBIve tried using this INSTALLLOCATION parameter numerous times without any luck... always installs to the default path regardless... Followed your steps to a t and no dice.
prathapml Posted November 27, 2004 Posted November 27, 2004 Ive tried using this INSTALLLOCATION parameter numerous times without any luck... always installs to the default path regardless... Followed your steps to a t and no dice.Works fine for me! It works with .NET, vmware, acrobat reader, diskeeper, etc.If you'd like someone to see what could be wrong, please describe what you do, and also which method you use to install (batch-files, or XPlode, or RunOnceEX, etc.)
durex Posted November 27, 2004 Author Posted November 27, 2004 Ran setup.exe /A at a command promptExtracted to C:\Temp\DiskeeperRenamed msi that was created in above path to setup.msiran the following from cmd line: setup.msi INSTALLLOCATION=C:\Temp\test /QBAfter install completes nothing is in C:\Temp\test, but it is installed to ProgFiles\ExecSoftware\DiskeeperI even tried creating the test folder before the install as well and it still doesnt work.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now