Jump to content
Sign in to follow this  
tom35i

IsAdmin Test

Recommended Posts

tom35i

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

Share this post


Link to post
Share on other sites
water

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 (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
GodlessSinner

#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

_____________________________________________________________________________

Share this post


Link to post
Share on other sites
tom35i

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

Share this post


Link to post
Share on other sites
spudw2k

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×