Jump to content

Diskeeper 9 Professional Unattended via VBScript


Recommended Posts

Posted

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, APP

Set FSO = CreateObject("Scripting.FileSystemObject")
Set AllDrives = FSO.Drives
Set WshShell = WScript.CreateObject("WScript.Shell")
SYSD = WshShell.ExpandEnvironmentStrings("%Systemdrive%")

' Check for CDROM
For Each Drive In AllDrives

  If Drive.DriveType = "4" Then

      If FSO.FileExists(Drive & "\WIN51") Then
          CDROM = Drive
          Exit For
      End If

  End If

Next

If Len(CDROM) = 0 Then WScript.Quit

APP = CDROM & "\Custom\Applications"

'Launch Installer
WshShell.Run (APP & "\Diskeeper9\setup.exe")

Do until WshShell.AppActivate ("Diskeeper Professional Edition")
   WScript.Sleep 2000
Loop
WScript.Sleep 1000

' Hit N for Next
WshShell.SendKeys "N"

WScript.Sleep 500

' Hit N for Next
WshShell.SendKeys "N"

WScript.Sleep 500

' Hit a for accept
WshShell.SendKeys "a"

WScript.Sleep 500

' Hit N for Next
WshShell.SendKeys "N"

'WScript.Sleep 500

' Hit C for Change
WshShell.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 Path
WshShell.SendKeys "{ENTER}"

WScript.Sleep 500

' Hit N for Next
WshShell.SendKeys "N"

WScript.Sleep 500

' Hit I for Install
WshShell.SendKeys "I"

Do until WshShell.AppActivate ("Product Registration")
   WScript.Sleep 2000
Loop
WScript.Sleep 1000

'Hit Tab twice to cancel Registration
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"

Do until WshShell.AppActivate ("Cancel Registration?")
   WScript.Sleep 2000
Loop
WScript.Sleep 1000

'Hit Tab once to never register
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"

WScript.Sleep 1500

'Click Finish for install
WshShell.SendKeys "{ENTER}"

WScript.Quit


Posted

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 demo

set WshShell = WScript.CreateObject ("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

'finding CDROM drive letter
For Each objDrive In fso.Drives
 If objDrive.DriveType = "4" And objDrive.IsReady Then
   If fso.FileExists(objDrive & "\WIN51") Then cdrom = objDrive
 End If
Next

WshShell.Popup "Your XPCD is in drive " & cdrom ,3,"Find CDROM in vbs"

Posted

@Asta

I 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.

@Bulldog

Thanks a bunch for the code.. always looking for ways to tighten it up.

Posted

Hi durex (what a name :D )

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.

Posted

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

Posted

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...

Posted
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. :D ]

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" /QB

If 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.....

Posted

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. :D

If Len(CDROM) = 0 Then 
WshShell.popup "CDROM not found",3,"Diskeeper"
WScript.Quit
End if

Posted
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. :D ]

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" /QB

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.

Posted
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.)

Posted

Ran setup.exe /A at a command prompt

Extracted to C:\Temp\Diskeeper

Renamed msi that was created in above path to setup.msi

ran the following from cmd line: setup.msi INSTALLLOCATION=C:\Temp\test /QB

After install completes nothing is in C:\Temp\test, but it is installed to ProgFiles\ExecSoftware\Diskeeper

I even tried creating the test folder before the install as well and it still doesnt work.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...