Check for Administrator prior to install

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • hankhuf
    Indigo Rose Customer
    • Sep 2003
    • 10

    Check for Administrator prior to install

    My software requires that the user have Administrator priviledges during the install if they are running XP or NT, but on older systems this does not matter. How can I test for these conditions and abort the install if an xp/nt "user" is attempting an install of my stuff?
  • Brett
    Indigo Rose Staff Member
    • Jan 2000
    • 2001

    #2
    Re: Check for Administrator prior to install

    Try using %IsUserNTAdmin%. From the help file:

    %IsUserNTAdmin%

    This variable is set to "TRUE" if the user running the setup is currently logged into Windows NT/2000/XP with Administrator permissions. It's set to "FALSE" otherwise. On systems that aren't running some version of Windows NT, this variable is always set to "FALSE".

    Comment

    • hankhuf
      Indigo Rose Customer
      • Sep 2003
      • 10

      #3
      Re: Check for Administrator prior to install

      I did see that this variable was available, but I don't quite see how it helps.

      What I need is something that is "TRUE" if the user running the setup is currently logged into Windows NT/2000/XP with Administrator permissions. And also "TRUE" on systems that aren't running some version of Windows NT. I figure that then if it is "FALSE" I can warn of the need for the permissions and abort the setup. Any ideas?

      Comment

      • Brett
        Indigo Rose Staff Member
        • Jan 2000
        • 2001

        #4
        Re: Check for Administrator prior to install

        That is exactly what it does. If on Windows 9x, it will always return TRUE.

        Comment

        • hankhuf
          Indigo Rose Customer
          • Sep 2003
          • 10

          #5
          Re: Check for Administrator prior to install

          In your first reply, you said, "On systems that aren't running some version of Windows NT, this variable is always set to "FALSE".

          Now it seems you are saying on Win98 systems it will return "TRUE". Or am I missing something here?

          Comment

          • Brett
            Indigo Rose Staff Member
            • Jan 2000
            • 2001

            #6
            Re: Check for Administrator prior to install

            I stand corrected [img]/ubbthreads/images/icons/blush.gif[/img]

            Sorry about that. Once again reality and what is in my mind are two different things. [img]/ubbthreads/images/icons/smile.gif[/img]

            Anyhow, for your condition you would want to do something like this:

            IF(!%IsUserNTAdmin% AND !(%IsWin95% OR %IsWin98% OR %IsWinME%))
            // Do something here
            END IF

            This condtion will be TRUE if the user is not an NT admin and are not running a Win9x system. Hopefully that helps!

            Comment

            • hankhuf
              Indigo Rose Customer
              • Sep 2003
              • 10

              #7
              Re: Check for Administrator prior to install

              That last worked out pretty well. I added an Abort Install screen as the first one to be evaluated for display. For the Screen Condition I used (as suggested):

              (!%IsUserNTAdmin%) AND !(%IsWin95% OR %IsWin98% OR %IsWinME%)

              When I ran the install from an Administrator account or on an a Win98 system the Abort Install screen did not appear and the install completed OK.

              When I ran the install from a Limited User account on an XP Pro machine, the install stumbled twice because it could not create the SF log file, but the only choice was to click OK and the third thing to appear was the Abort Install screen with my text explaining what had happened. That's good enough for me.

              Thanks for the help.

              Comment

              Working...
              X