Results 1 to 7 of 7

Thread: Check if adminstrator vista

  1. #1

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Check if adminstrator vista

    Does anyone know how to check if program needs to be installed as adminstrator or how to run something than will return an error if command needs to be run as adminstrator so i can trap the error ?
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  2. #2
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Check if adminstrator vista

    If your question is "Does this user I'm running under have admin rights (i.e. am I running elevated)?" you could use this:

    IsUserAnAdmin: Determine if the Current User is an Administrator

    I hope that helps! Nice and concise.

  3. #3

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Check if adminstrator vista

    Quote Originally Posted by dilettante
    If your question is "Does this user I'm running under have admin rights (i.e. am I running elevated)?" you could use this:

    IsUserAnAdmin: Determine if the Current User is an Administrator

    I hope that helps! Nice and concise.
    thanks for the link, unfortunately i don't have vista to check right away
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  4. #4
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Check if adminstrator vista

    It works on Win2K and later. Prior to Vista it returns True if running under an admin account. Starting with Vista it only returns True when running with elevation.

  5. #5
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Check if adminstrator vista

    Well, if you're using an installer then it usually takes care of everything for you. If not, just incorporate the manifest in your application that automatically elevates your application (if you're already an admin it does nothing).
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  6. #6
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Check if adminstrator vista

    If you are attempting to write an installer yourself, you should use one of the already tried and tested ones. You really can't write one totally in VB anyway...

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Check if adminstrator vista

    Quote Originally Posted by randem
    If you are attempting to write an installer yourself, you should use one of the already tried and tested ones. You really can't write one totally in VB anyway...
    Sure you can. Just include the vb 6 runtimes and other dependancy files on the CD in the app dir as that is the first location Windows looks for dependancy files.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width