This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: UAC headache in bootstrapper
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 19, 2010
03:05 AM
UAC headache in bootstrapper
I have a bootstrap setup.exe which successfully installs multiple msi's and configures the system. I have a custom action that launches the setup.exe from programs and features. If used as immediate execution it works fine on UAC disabled machines but does not even execute on UAC enabled ones. If I use Deferred as system execution it runs under the system account which is no good as the setup needs to run as a domain user account. My bootstrapper is signed and manifested, signing the msi also does not help. Is it possible to add a manifest to the msi? alternatively has anyone managed to elevate an msi without using a bootstrapper?
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 19, 2010
12:54 PM
From what you describe, you have two options: don't require elevation to launch your bootstrap, or write a custom action that uses ShellExecute or a similar API to launch the boostrap. The direct options that Windows Installer exposes use the CreateProcess API which does not allow the user interface for elevation.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 19, 2010
11:15 PM
Thanks Michael
Finally got it to work using the following VBScript in A CA. This script relaunches it's self in elevated mode. Hope this helps others 🙂
If WScript.Arguments.Length = 0 Then
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "wscript.exe" , Chr(34) & WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1
Else
RunSetup
End If
Function RunSetup
on error resume next
Dim sPath
Dim sDir
Dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
set objShell=CreateObject("Wscript.Shell")
sPath = objShell.CurrentDirectory & "\Setup\Setup.exe"
msgbox sDir & vbcrlf & sPath
if filesys.FileExists(sPath) then
objShell.CurrentDirectory = objShell.CurrentDirectory
'objShell.Exec sPath
If FSO.FileExists(sPath) Then
objShell.ShellExecute sPath
end if
else
sDir = GetInstallDirectoryByGUID("{052B5AC5-7EA7-0904-0000-4A02000C66F4}", "{60056885-0E39-4AD9-8902-19ED3BEBC6BE}")
sPath = GetInstallDirectoryByGUID("{052B5AC5-7EA7-0904-0000-4A02000C66F4}", "{E1894689-DFFB-4510-9FD6-B7C0BA307349}")
'msgbox sDir & vbcrlf & sPath
if sPath <> "" then
objShell.CurrentDirectory = sDir
If FSO.FileExists(sPath) Then
objShell.Exec sPath
'msgbox sPath
end if
else
objShell.CurrentDirectory = Session.Property("SOURCEDIR")
If FSO.FileExists("Setup.exe") Then
objShell.Exec "Setup.exe"
end if
end if
end if
GetInstallParams = ERROR_INSTALL_USEREXIT
End function
Function GetInstallDirectoryByGUID(sProductGUID, sComponentGUID)
On Error Resume next
Dim Installer
Dim oProduct
Dim sPath
set Installer = CreateObject("WindowsInstaller.Installer")
For Each oProduct In Installer.Products
If oProduct = sProductGUID Then
sPath = Installer.ComponentPath(oProduct, sComponentGUID)
GetInstallDirectoryByGUID = "" & sPath & ""
Exit Function
End If
Next
GetInstallDirectoryByGUID = ""
End Function
Function GetValue (Path, Key)
Dim RetValue
on error resume next
const HKEY_LOCAL_MACHINE = &H80000002
'const HKEY_CURRENT_USER = &H80000001
'const HKEY_CLASSES_ROOT = &H80000000
'const HKEY_USERS = &H80000003
'const HKEY_CURRENT_CONFIG = &H80000005
'const HKEY_DYN_DATA = &H80000006
Computer = "."
Set Reg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\default:StdRegProv")
Reg.GetStringValue HKEY_LOCAL_MACHINE, Path, Key, RetValue
RetValue = RetValue & ""
GetValue = RetValue
End Function
Function SetValue (Path, Key, Value)
On Error Resume next
Dim WSHShell, RegKey
Set WSHShell = CreateObject("WScript.Shell")
RegKey = "HKLM\" & Path & "\" & Key
WSHShell.RegWrite RegKey, Value, "REG_SZ"
End Function
Function GetINSTALLDIR
On Error Resume next
Dim sPath
Dim REGPATH
REGPATH = "SOFTWARE\SourceCode\BlackPearl\BlackPearl Studio"
sPath = GetValue (REGPATH, "InstallDir")
if sPath = "" then
sPath = "C:\Program Files\K2.net 2007"
end if
GetINSTALLDIR = sPath
end function
Function GetSUPPORTDIR
On Error Resume next
Dim sPath
Dim REGPATH
REGPATH = "SOFTWARE\SourceCode\BlackPearl\BlackPearl Studio"
sPath = GetValue (REGPATH, "SUPPORTDIR")
if sPath = "" then
sPath = Session.Property("SUPPORTDIR")
end if
GetSUPPORTDIR = sPath
end function
'
Finally got it to work using the following VBScript in A CA. This script relaunches it's self in elevated mode. Hope this helps others 🙂
If WScript.Arguments.Length = 0 Then
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "wscript.exe" , Chr(34) & WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1
Else
RunSetup
End If
Function RunSetup
on error resume next
Dim sPath
Dim sDir
Dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
set objShell=CreateObject("Wscript.Shell")
sPath = objShell.CurrentDirectory & "\Setup\Setup.exe"
msgbox sDir & vbcrlf & sPath
if filesys.FileExists(sPath) then
objShell.CurrentDirectory = objShell.CurrentDirectory
'objShell.Exec sPath
If FSO.FileExists(sPath) Then
objShell.ShellExecute sPath
end if
else
sDir = GetInstallDirectoryByGUID("{052B5AC5-7EA7-0904-0000-4A02000C66F4}", "{60056885-0E39-4AD9-8902-19ED3BEBC6BE}")
sPath = GetInstallDirectoryByGUID("{052B5AC5-7EA7-0904-0000-4A02000C66F4}", "{E1894689-DFFB-4510-9FD6-B7C0BA307349}")
'msgbox sDir & vbcrlf & sPath
if sPath <> "" then
objShell.CurrentDirectory = sDir
If FSO.FileExists(sPath) Then
objShell.Exec sPath
'msgbox sPath
end if
else
objShell.CurrentDirectory = Session.Property("SOURCEDIR")
If FSO.FileExists("Setup.exe") Then
objShell.Exec "Setup.exe"
end if
end if
end if
GetInstallParams = ERROR_INSTALL_USEREXIT
End function
Function GetInstallDirectoryByGUID(sProductGUID, sComponentGUID)
On Error Resume next
Dim Installer
Dim oProduct
Dim sPath
set Installer = CreateObject("WindowsInstaller.Installer")
For Each oProduct In Installer.Products
If oProduct = sProductGUID Then
sPath = Installer.ComponentPath(oProduct, sComponentGUID)
GetInstallDirectoryByGUID = "" & sPath & ""
Exit Function
End If
Next
GetInstallDirectoryByGUID = ""
End Function
Function GetValue (Path, Key)
Dim RetValue
on error resume next
const HKEY_LOCAL_MACHINE = &H80000002
'const HKEY_CURRENT_USER = &H80000001
'const HKEY_CLASSES_ROOT = &H80000000
'const HKEY_USERS = &H80000003
'const HKEY_CURRENT_CONFIG = &H80000005
'const HKEY_DYN_DATA = &H80000006
Computer = "."
Set Reg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\default:StdRegProv")
Reg.GetStringValue HKEY_LOCAL_MACHINE, Path, Key, RetValue
RetValue = RetValue & ""
GetValue = RetValue
End Function
Function SetValue (Path, Key, Value)
On Error Resume next
Dim WSHShell, RegKey
Set WSHShell = CreateObject("WScript.Shell")
RegKey = "HKLM\" & Path & "\" & Key
WSHShell.RegWrite RegKey, Value, "REG_SZ"
End Function
Function GetINSTALLDIR
On Error Resume next
Dim sPath
Dim REGPATH
REGPATH = "SOFTWARE\SourceCode\BlackPearl\BlackPearl Studio"
sPath = GetValue (REGPATH, "InstallDir")
if sPath = "" then
sPath = "C:\Program Files\K2.net 2007"
end if
GetINSTALLDIR = sPath
end function
Function GetSUPPORTDIR
On Error Resume next
Dim sPath
Dim REGPATH
REGPATH = "SOFTWARE\SourceCode\BlackPearl\BlackPearl Studio"
sPath = GetValue (REGPATH, "SUPPORTDIR")
if sPath = "" then
sPath = Session.Property("SUPPORTDIR")
end if
GetSUPPORTDIR = sPath
end function
'