[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 696
  • Last Modified:

Require Administrator Privileges ( VB6.,0 )

I have an application made in visual basic v6.0 .. i am curious to know if there is any way to add a rule to the software so it will require admin privileges so it can run..

Any easy way to do this?
  • 2
1 Solution
Meir RivkinFull stack Software EngineerCommented:
u can add a validation code in your app to check the user who runs the app.
if he's not a domain admin or local admin, notify and close the app.
Meir RivkinFull stack Software EngineerCommented:
here's a code snippet:
Private Declare Function IsNTAdmin Lib "advpack.dll" (ByVal dwReserved As Long, ByRef lpdwReserved _ As Long) As Long

Private Sub Form_Load()
Debug.Print "Are you an Administrator? " & CBool(IsNTAdmin(ByVal 0&, ByVal 0&))
End Sub

Open in new window

Nice post from egl1044 (second post in question) on how to retrieve if the user has admin rights without asking the user,

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now