PDA

View Full Version : build should install only by administrator



satyamurthy
03-03-2004, 02:48 AM
I want to create a setup which should be installed only by the administrator.

I am using Install Shield Express 4.0..

Pls help....

Thanks in advance

veebeefive
03-19-2004, 04:23 PM
I dont think you can actually specify this as a launch condition, the only way around this is to only allow administrators to install programs.

Carl.

jburton
03-22-2004, 06:10 PM
'In Win 2000, XP, 2003 you have Windows
'Management Instrumentation on the system.
'Use this VBscript to get WMI to see if the
'user has logged in as the administrator. Save this
'script as CheckAdmin.vbs and add it to IE as "CheckAdmin".

'Set the script NOT to run under Win 95, 98, Me as
'there's no point.

Function CheckAdmin()

' Comment the next line out when script works okay
MsgBox "Start of CheckAdmin"

Dim oSystem
Dim oItem

Dim strUser
Dim intResult

intResult = 0

' get the current user
Set oSystem = GetObject("WinMgmts:{impersonationLevel=impersonate}") _
.InstancesOf("Win32_ComputerSystem")
For Each oItem In oSystem
strUser = oItem.UserName
Exit For
Next

' test for Administrator
Set oSystem = GetObject("WinMgmts:{impersonationLevel=impersonate}") _
.InstancesOf("Win32_NetworkLoginProfile")
For Each oItem In oSystem
If strUser = oItem.Name Then
If oItem.Privileges <> 2 Then
MsgBox _
"Please log in again as the Administrator" & vbCr & _
"and restart the installation.", _
vbInformation, "System requirements"
intResult = 1602
End If
End If
Next

' Comment the next line out when script works okay
MsgBox "CheckAdmin = " & intResult
CheckAdmin = intResult

End Function

veebeefive
03-22-2004, 06:16 PM
Excellent piece of code.

Should prove very useful to happy installer authors out there...!

However, is there a way to achieve this using NT? There are still users of this OS out there... Can you not install WMI on NT with service pack 6a?

jburton
03-23-2004, 06:58 AM
For NT you need to make you user stop and run WMICORE.EXE which you can dowload from MS.

Loook for: Windows Management Instrumentation (WMI) CORE 1.5 (Windows 95/98/NT 4.0) in the downlads area.

Any poor souls still running NT are hopefully in an organisation that has an administrator who can do that for them.

veebeefive
03-23-2004, 07:31 AM
The issue here is that the installer should self contain ANY functionality that is imposed on the user. If the installer doesn't look good or perform as expected and worse still doesn't work, you can pretty much kiss a lot of sales goodbye!

Only in the largest organisations would you have any administrator that will possibly perform the install or even do an administrative installation for general rollout.

Thats another good question, does installshield offer the administrative install build option as does ms visual installer in .net?