Jump to content

IsAdmin Test


tom35i
 Share

Recommended Posts

Hey all

I am trying to create a program that will display if the current user has admin rights or not

I can get

If IsAdmin() Then MemoWrite("User Has Admin Rights")

but i want it to display is the user dos not have admin rights which i think would be the following

If IsAdmin() Then MemoWrite("User Has Admin Rights") else MemoWrite("User Does Not Have Admin Rights")

but i keep getting an error when i compile

any ideas

thank you

YEA BOIhttp://www.myspace.com/comeoutfiringhttp://www.last.fm/music/comeoutfiringhttp://www.facebook.com/pages/comeoutfiring/75676261698http://www.reverbnation.com/comeoutfiringhttp://www.purevolume.com/comeoutfiringhttp://www.twitter.com/comeoutfiringhttp://www.youtube.com/comeoutfiring

Link to comment
Share on other sites

AutoIt doesn't allow this syntax to be written in one line. This should work:

If IsAdmin() Then 
    MemoWrite("User Has Admin Rights") 
else 
    MemoWrite("User Does Not Have Admin Rights")
endif
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#RequireAdmin
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("User privilegies", 292, 67, 577, 717)
$Input1 = GUICtrlCreateInput("", 16, 8, 257, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x008000)
If IsAdmin() Then
    GUICtrlSetData($Input1, "User have admin rights")
    GUICtrlSetBkColor($Input1, 0x008000)
Else
    GUICtrlSetData($Input1, "User haven't admin rights")
    GUICtrlSetBkColor($Input1, 0xFF0000)
EndIf
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

(Use #RequireAdmin if needed)

Edited by Godless

_____________________________________________________________________________

Link to comment
Share on other sites

cheers guys very useful

YEA BOIhttp://www.myspace.com/comeoutfiringhttp://www.last.fm/music/comeoutfiringhttp://www.facebook.com/pages/comeoutfiring/75676261698http://www.reverbnation.com/comeoutfiringhttp://www.purevolume.com/comeoutfiringhttp://www.twitter.com/comeoutfiringhttp://www.youtube.com/comeoutfiring

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...