Convert Any Application Install to NSIS, Part 1
There are many reasons you might want to convert your existing and forthcoming application installs to use NullSoft Install System (NSIS). NSIS installs are only a single .exe file, they are small, and they are fast.
This two-part article series will guide you through the process of converting the Microsoft Office 2007 install into an NSIS package. Using the methods described in this article, I was able to convert the Microsoft Office install into a single file rather than 6,622. The size of the Microsoft Office 2007 installer is 560 MB, but the NSIS installer compressed down to 370 MB, that's 33% smaller! The Microsoft Office installer took 8 minutes to complete (not including the time to download), but the NSIS installer finished in 2½ minutes!
This part of this article series will teach you to...
- Install prerequisites
- Install your application into a new SVS layer
- Get information about the layer and application
- Backup your layer
- Optionally, customize the virtualized application
- Automatically Clean the SVS layer
- Manually Clean the SVS layer
- Copy the files from the SVS layer
In part 2, you will learn how to...
- Export the registry from the SVS layer into registry.reg
- Use the New Script Wizard to create the foundation of your installer
- Fix the context of the "ALL$..." destination directories
- Add registry.reg to the script
- Change compression options
- Optionally, make your installer truly silent
- Compile your installer
- Test and use your new installer
Install Prerequisites
To convert your application installs to NSIS, you will need a base computer with SVS installed on it. This computer should be the least common denominator (minimum installed applications) of all the images in your environment. You can find more information about downloading and installing SVS here. Make sure to install the Software Virtualization Admin Console.
You will also need a computer with NSIS and an NSI Editor. This can be your reference computer or a different computer. First we will install NSIS. You can download the latest version of NSIS at http://nsis.sourceforge.net/Download. Download and run the installer, accepting all the defaults. When the installer says that it has completed, uncheck both "Run NSIS" and "Show release notes" and click Finish.
Next we will install HM NIS Edit. You can download the latest version of HM NIS Edit at http://hmne.sourceforge.net/index.php#Download. Download and run nisedit2.x.x.exe, accepting all the defaults. When the installer says that it has completed, make sure "Run HM NIS Edit" is not checked and click Finish.
Install Your Application Into a New SVS Layer
Open the Software Virtualization Admin Console. Click File, and then "Create New Layer..." Choose "Install Application" and click Next.
Give the new layer a name, and click Next.
Choose "Single program capture" and click "Browse..." Find the executable or .msi installer for the application. For Office 2007, we will choose "D:\setup.exe". Click Next. Click Finish.
Follow the application install wizard to install the application however you want to. When the install is complete, right-click the new layer you just created and click "Deactivate Layer".
Get Information About the Layer and Application
For the remainder of the steps, we will need to refer to some data we can find in the original layer's registry.
Open your Registry Editor and navigate to HKEY_LOCAL_MACHINE\SYSTEM\Altiris\FSL. You will see two or more sub-keys that have a number for their name. Open each subkey and look for one that has a value called "Name" that contains the name of your layer and a value called "ReadOnly" that is set to "1". This key will have two values in particular that we are interested in. Write down the data contained in the "FileRedirect" and "RegRedirect" values, we will refer to them later as <FileRedirect> and <RegRedirect>.
Now navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\fslrdr\<RegRedirect>\HLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
You should only see one subkey. If there are more than one, find the one with a DisplayName that matches the name of the application you installed. Write down the data contained in the "DisplayName", "VersionMajor", and "VersionMinor" values, we will refer to them later as <DisplayName>, <VersionMajor>, and <VersionMinor>.
Since this article is guiding you through the creation of an installer for Microsoft Office 2007, <DisplayName> will be "Microsoft Office Enterprise 2007", <VersionMajor> will be "12", and <VersionMinor> will be "0" in all of the examples and screenshots.
Backup Your Layer
Before you continue, you should make a backup copy of your layer files and registries. Copy all the files from the <FileRedirect> folder into a backup folder. Open regedit and navigate to the <RegRedirect> key. Rright-click the <RegRedirect> key and choose export. Save the .reg file in the same location you have the <FileRedirect> backup. That way if you run into any problems you can always revert to this point and continue from here.
Optionally, Customize the Virtualized Application
Now would be a good time to make any customizations you may want to the layer. You might want to activate the layer, play around with the changes you want to make and then write down a list of changes you want to make. That way when you are ready to commit the changes you will be able to do so as directly and quickly as possible so that your changes do not affect to much of the layer. When you are done planning the changes you want to make, deactivate and reset the layer, this will clear the changes that you have made and reset it to the fresh install you had originally.
If you decided that you don't really need to make a change, move to the next section of this article. If you do want to make some changes, go to the File menu and choose "Update Existing Layer..." select the layer and click "Next". For the program name, enter "C:\WINDOWS\system32\cmd.exe", then click "Next" and click "Finish". This will open a command window in the read-only portion of the layer. Remember that any changes made here are permanent, so tread lightly.
In the Start Menu or Desktop, find the icons of the applications you want to open and drag them into the command window, then go back to the command window and press the enter key. This will open the application inside the layer capture and allow you to make changes. Repeat the process for all the applications you want to open and configure. When you are done, go back to the command window and type "exit" and then press enter.
Automatically Clean the SVS Layer
Next, you will want to clean the file and registry changes that were captured during the layer creation that are system changes that are not related to the actual application install. To do this, you will need to download the SVS Cleaner utility that I have written for this purpose.
SVSCleaner requires .NET Framework 2.0, if your reference machine does not have .NET Framework 2.0, you will need to export the layer and import it onto a computer that does have .NET Framework 2.0, or you can download .NET Framework 2.0 and install it on your reference computer. Once you have extracted SVSClean.zip to a computer that has both .NET Framework 2.0 and your SVS Layer, you are ready to use SVSClean.exe.
I have updated the definition file for SVSCleaner to support Microsoft Office 2007. It cleans less than the original definition file because the original definition file would delete registry keys that Office 2007 requires. You can download this updated definition fileand extract SVSClean.csv to the same folder as SVSClean.exe, replacing the original.
You will want to leave the original uninstaller that was created with the install of your application, this will allow any custom action that may be required to be run during uninstall (like selective removal of Microsoft Shared tools). Microsoft Office 2007, Adobe Acrobat, and other applications store their activation/license information in the uninstall information. So, make sure that "Uninstall Information" is disabled and "Registry and Files" is enabled.
If you want to be more specific about the file and registry changes made during the cleanup process, you can go to the Advanced tab. Click OK to begin the cleanup process. The cleanup process will take a few minutes. When the progress bar is at 100%, the cleanup is done. Click Close to exit the utility.
Now that you have a clean layer with your application configured the way you want it, we can start creating an NSIS install package.
Manually Clean the SVS Layer
After SVSClean.exe has cleaned the layer, there might still be some temporary files left in your layer. You will want to go through the files and folders in the <FileRedirect> folder and delete any that are obviously temporary files that are not required by the installer. For the Microsoft Office 2007 install, I ended up deleting the following files and folders:
- OSVER.INI
- DELLIST.TXT
- DELREG.TXT
- [_B_]COMMONAPPDATA[_E_]\Microsoft\Crypto\
- [_B_]COMMONAPPDATA[_E_]\Microsoft\MSDAIPP\
- [_B_]WINDIR[_E_]\PCHEALTH\
- USER_TEMPLATE\
Copy the Files from the SVS Layer
Now you will need to copy the application files from the SVS layer to a directory so that we can create an installer using them. If it doesn't already exist, create a folder named "NSIS" in the "My Documents" folder on the computer that has NSIS and HM NIS Edit.
In the "NSIS" folder, create a new folder with the name of the application you are creating an installer for (for example, "Microsoft Office 2007"); this will be your NSIS Project folder. Next, copy the contents of the <FileRedirect> folder into your NSIS Project folder.
This concludes part one of this series. Now that you have prepared all of the file changes that this installer will need to make, you can proceed to part two.
- Login or register to post comments
- 2478 reads
- Printer-friendly version






















Manually Clean the SVS Layer
There are a few registry keys that you will want to remove that SVS relies on but you will not want deployed through your installer.
While you are cleaning the layer, be sure to delete these registry keys:
RE: Manually Clean the SVS Layer
In the previous post, I reported the registry keys from the perspective of inside the layer. Since you will be removing the keys when the layer is disabled, you should actually remove the following keys:
Part 2
Can you add in a link to Part 2 of this article