SCCM Package – Molecular Workbench

Molecular Workbench is an interesting beast. It comes in two versions: ‘online’ and ‘offline’ . The program is basically a java-based web browser with fancy extensions for interactive animations. The online version is a simple jar file that connects to the MW website. The offline version downloads a local copy of the entire MW website content.


General Info

The online version works great, except that it asks to update all the time. Since our undergrad students don’t have admin access, the update fails. This causes mass confusion and many riots\panic attacks. Fortunately, the offline version works very well with a few tweaks.

By default, the offline version won’t launch without administrator rights. I was able to launch the offline version by creating a shortcut to the system’s javaw.exe, using arguments to specify the  proper jar file and java environment parameters. The Molecular Workbench support team filled in some of the gaps in my knowledge on this one.

Another quick note — if a non-admin runs the program it will prompt to create a firewall rule. To prevent this, the silent install batch file runs a netsh command to create a firewall rule blocking outgoing java. This successfully prevents the prompt.


  1. First, we need to get the icon used for the start menu shortcut. Visit the molecular workbench website and choose “Install MW”. This will install and run the online version.
  2. On first run, the online version creates a desktop shortcut. Right-click the desktop shortcut and choose “Properties”.
  3. On the “Properties” window of the shortcut, click “Change Icon”.
  4. Copy the icon file listed in the top text box to your Molecular Workbench SCCM Package source folder and rename it to “mw.ico”.
  5. Now that we have the icon, let’s start on the program itself. Download the molecular workbench offline version from the website above.
  6. Extract the supplied file “” to C:\temp.
  7. Use WinRAR to create a SFX file containing the contents of C:\temp\cd using the following properties:
    Path to Extract — choose “create in program files” then enter “mw”
    Silent mode – hide start dialog
    Update – overwrite existing files
  8. The final SFX should look like the following image and be named mw-offline-30.exe.
  9. Create a script named “Make-Shortcuts_mw.ps1″ that creates the Molecular Workbench shortcuts. For help creating a shortcut script see my previous blog post “Creating Shortcuts for SCCM Packages“.
    Use the following parameters:

    Target Path: "C:\Program Files\java\jre6\bin\javaw.exe"
    Arguments: "-jar mw.jar remote CC-MW-CD\cd.cml"
    Shortcut Name: "Molecular Workbench.lnk"
    Working Directory: "C:\Program Files (x86)\mw"
    IconPath: "C:\Program Files (x86)\mw\mw.ico"

    Since this script is a bit more complex than the one provided at the previous blog post link, I’ve included the full script we use (following text). You may need to modify lines 38 and 43-48.

    #This script installs shortcuts in the 'all users' start menu.
    Function Read-EnvVariable($varName)
    		$varName = "ProgramData"
    		#This function reads any environment variable passed by "varName" and returns it.
    		$oVariable = gci env: | where {$_.Name -eq $varName}
    		$strValue = $oVariable.Value
    		$retval = $strValue
    		Return $retval
    Function Create-Shortcut($pathToExe,$destinationPath,$iconPath,$workingDirectory,$arguments)
    		If($iconPath -eq $null)
    			{$iconPath = ($pathToExe + ",0")}
    		$shell = New-Object -ComObject ("WScript.Shell")
    		$shortcut = $shell.CreateShortcut($destinationPath)
    		$shortcut.TargetPath = $pathToExe
    		$shortcut.IconLocation = $iconPath
    		$shortcut.arguments = $arguments
    		If($workingDirectory -ne $null){$shortcut.workingDirectory = $workingDirectory}
    		##close shell somehow
    #declare the shortcut entries collection
    $aShortcutEntries = @()
    ##get some variables needed
    $programDataPath = Read-EnvVariable "ProgramData"
    $ChemistryAppsPath = ($programDataPath + "\Microsoft\Windows\Start Menu\Programs\Chemistry Applications\")
    #declare specific shortcut entries
    $shortcutEntry = New-Object System.Object
    $shortcutEntry | Add-Member -type NoteProperty -name PathToExe -value "C:\Program Files\java\jre6\bin\javaw.exe"
    $shortcutEntry | Add-Member -type NoteProperty -name arguments -value "-jar mw.jar remote CC-MW-CD\cd.cml"
    $shortcutEntry | Add-Member -type NoteProperty -name Name -value "Molecular Workbench.lnk"
    $shortcutEntry | Add-Member -type NoteProperty -name destinationPath -value ($ChemistryAppsPath + $shortcutEntry.Name)
    $shortcutEntry | Add-Member -type NoteProperty -name iconPath -value "C:\Program Files (x86)\mw\mw.ico"
    $shortcutEntry | Add-Member -type NoteProperty -name workingDirectory -value "C:\Program Files (x86)\mw\"
    $aShortcutEntries += $shortcutEntry
    $shortcutEntry = $null
    #make the target directory if needed
    if( (Test-path $ChemistryAppsPath) -eq $false )
    		New-Item $ChemistryAppsPath -type directory
    #make the shortcuts
    $aShortcutEntries | % {
    	$pathToExe = $_.PathToExe
    	$destinationPath = $_.destinationPath
    	$iconPath = $_.IconPath
    	$workingDirectory = $_.workingDirectory
    	$arguments = $_.arguments
    	##example: Create-Shortcut "C:\g09w\gview.exe" ($programDataPath + "\Microsoft\Windows\Start Menu\Programs\Chemistry Applications\GaussView.lnk")
    	Create-Shortcut $pathToExe $destinationPath $iconPath $workingDirectory $arguments
  10. Create a batch file named “Install-mw.cmd” with the following contents:
    ECHO Installing Molecular Workbench Offline Version
    ECHO Do not close this window. It will close when the install is finished.
    REM Main Install
    xcopy /y /e mw.ico "C:\Program Files (x86)\mw"
    REM Config
    netsh advfirewall firewall add rule name="Block JAVAW Incoming" dir=in program="c:\windows\system32\javaw.exe" remoteip=localsubnet action=block
    netsh advfirewall firewall add rule name="Block JAVAW Incoming" dir=in program="C:\Program Files\java\jre6\bin\javaw.exe" remoteip=localsubnet action=block
    REM Shortcuts
    powershell -noprofile -command "& {$a = get-executionpolicy;If((get-executionpolicy) -ne 'Unrestricted'){set-executionpolicy unrestricted -force;}; .\Make-Shortcuts_MW.ps1; set-executionpolicy $a}"
  11. Assemble the files into a single source folder then create a SCCM package and program. The program’s command line action should be “install-mw.cmd”. The following is a screen shot of my final source folder.

Whew, that one was a bit more work than usual eh?


One thought on “SCCM Package – Molecular Workbench

  1. Pingback: Table of Contents | windowsmasher

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s