Category Archives: Check Admin Rights

Check Admin Rights

Check if the current user is a local administrator using the Windows Installer service.

Dim oInst, oSess, iAdmin, oProducts
Const msiUILEVELNONE = 2
Set oInst = CreateObject(“WindowsInstaller.Installer”)
oInst.UILevel = msiUILEVELNONE
Set oProducts = oInst.Products
Set oSess = oInst.OpenProduct(oProducts(0))
iAdmin = oSess.Property(“AdminUser”)
If iAdmin = 1 Then
Msgbox “You are a local administrator!”, vbInformation, “ADMINISTRATOR”
Msgbox “You are not a local administrator!”, vbCritical, “NON-ADMIN”
End If