Video Screencast Help

Handling SHIMs in Wise Package Studio

Created: 17 Nov 2010 • Updated: 26 Apr 2011 | 9 comments
Language Translations
CableGuy41's picture
+30 30 Votes
Login to vote

This article talks about creating and applying SHIMs to bypass UAC prompts during application launch in Windows Vista and Windows 7.

When you launch an application shortcut from Start Menu/Desktop/Quick Launch, it may prompt UAC prompt for Standard User. It can be suppressed through applying a SHIM to the main executable.

This article talks about creating a SHIM and installing/uninstalling SHIM in two different methods using Wise Package Studio:

  1. Using a custom action in MSI/MST

  2. Using Registry   

Creating a SHIM:

Requirement: Application Compatibility Tool Kit

Open Compatibility Administrator and create a new Application Fix. Below window pops up and it has 3 fields.

  1. Name of the Application
  2. Vendor
  3. Executable file path [Shortcut target executable path]

Enter the information and click NEXT

Compatibility mode window, select NONE from “Operating System modes” and click NEXT

Under compatibility Fixes select the following options and click NEXT:

  1. EnableDEP
  2. RunAsAdmin
  3. RunAsHighest
  4. RunAsInvoker
  5. ForceAdminAccess 

Click FINISH and save the shim database file [.SDB] to a location. This SDB file should be used in the Custom Action to install/uninstall.

1.Installing/Uninstalling a SHIM through CUSTOM ACTION:

A SHIM database file [.SDB] can be installed using sdbinst.exe, which is part of Operating System and exists under C:\Windows\System32

Use the Full path of the SDB file for installation and uninstallation like below:

Installation:        Sdbinst.exe <PATH OF .SDB>

Uninstallation:   Sdbinst.exe –u <PATH OF .SDB>

The same commandline for installation and uninstallation can be implemented using Custom Action in Wise Package Studio.

Copy .SBD file to [INSTALLDIR]. Install custom action should be DIFFERED EXECUTION IN SYSTEM CONTEXT and should be before INSTALLFINALIZE.

Uninstall custom action should be DIFFERED EXECUTION IN SYSTEM CONTEXT and should be immediately after INSTALLINITILIZE [or before REMOVEFILES custom action] as the SDB file is part of installation.

2. Installing/Uninstalling a SHIM through REGISTRY:

Step 1: Add shim (sdb file) to the package. For example: INSTALLDIR

Step 2: Add the registry (Shim.reg attached to this article) to the package as shown below:

Step 3: Edit the registry settings to the required value. Rename [FileName] to the actual name of the file which requires shim. For example:  KCM310.CPL

Database Description: Name of Shim file. For example: KCM310

DatabasePath: Path to sdb file. For example: [INSTALLDIR]KCM310.sdb

Note: Shim.reg.txt file has been attached to this article. Download and rename the file to "Shim.reg" and add it to MSI/MST.  

I hope this helps.  

Comments 9 CommentsJump to latest comment

scriptinguy11's picture

I just tried the way it was explained in this article where I need to apply SHIM to bypass a prompt which is asking me for ADMIN user name and password. It just worked for me. 

I'm look at your articles and they are damn useful for those who started packaging. Great job. Thank you. 

Login to vote
B_Raj's picture

Good Work Eswar :-)

Login to vote
bibhashnag's picture

Can this be handled using a transform?

Bibhash Nag

Login to vote
CableGuy41's picture

Yes, ofcourse!


Do not forget to mark a SOLUTION

Login to vote
EdT's picture

Your instruction:

Copy .SBD file to [INSTALLDIR]. Install custom action should be DIFFERED EXECUTION IN SYSTEM CONTEXT and should be after INSTALLFINALIZE.

I was under the impression that Deferred custom actions could only be sequenced between InstallInitialize and InstallFinalize, and not after InstallFinalize, as deferred actions are incorporated in the installation scripts which are generated after InstallInitialize and committed by the InstallFinalize action. 

Also, as the custom action is making system changes, it should be before InstallFinalize.  Did you intend to write that this custom action should be just BEFORE InstallFinalize rather than just after?



If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

Login to vote
CableGuy41's picture

Thats a good point Ed.

Thank you for noticing. Yes, That should be BEFORE InstallFinilize.


Do not forget to mark a SOLUTION

Login to vote
piyushnasa's picture

Very Nice article, but there is one more point which I would like to add here.

The Shim Database creates an entry in Add/Remove programs and if there are a lot of shims created there will be a long list of Shim Database entries in ARP. To remove this you can add a DWORD registry key in "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{ShimProductID}.sdb\" hive as SystemComponent = 1

Piyush Nasa Altiris Certified Professional (ACP)

Login to vote
BB_HAN's picture

this info really helps. 

Login to vote
HK101's picture

SHIMs are very useful when the shortcut that prompts UAC is part of the application main functionality. In standard user environment SHIMs are significantly useful. thanks for the article.

Login to vote