/build/static/layout/Breadcrumb_cap_w.png

Check Local Admin Status

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"

Else

Msgbox "You are not a local administrator!", vbCritical, "NON-ADMIN"

End If


Comments

This post is locked

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login
Blog

View More Blogs from WiseUser

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ