Jump to content

IsAdmin


SMurphy
 Share

Recommended Posts

Okay, as I continue forward on my Novell to AD migration VBScript, I've hit a small snag. At a previous client, they had AutoIT and had a .exe called IsAdmin. It returned a 1 or a 0 depending on the rights of the user. I see that this is a function in AutoIT and have even been able to test it successfully using...

if IsAdmin <> 0 then
msgbox(0,"","You have admin rights")
end if

However, what I really want is an executable that I can call from VBScript and then capture the return code like this...

Set oShell = CreateObject("Wscript.Shell")

rcIsAdmin = oShell.Run("Isadmin.exe -q", 0, True)

If rcIsAdmin = 0 Then
    Wscript.Echo "You have do not have admin rights"
    WScript.Quit
End If

Thanks,

Sean

Edited by SMurphy
Link to comment
Share on other sites

  • Developers

Okay, as I continue forward on my Novell to AD migration VBScript, I've hit a small snag. At a previous client, they had AutoIT and had a .exe called IsAdmin. It returned a 1 or a 0 depending on the rights of the user. I see that this is a function in AutoIT and have even been able to test it successfully using...

if IsAdmin <> 0 then
msgbox(0,"","You have admin rights")
end if

However, what I really want is an executable that I can call from VBScript and then capture the return code like this...

Set oShell = CreateObject("Wscript.Shell")

rcIsAdmin = oShell.Run("Isadmin.exe -q", 0, True)

If rcIsAdmin = 0 Then
    Wscript.Echo "You have do not have admin rights"
    WScript.Quit
End If

Thanks,

Sean

Did you try RunWait() ? should return the RC of the program ...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Did you try RunWait() ? should return the RC of the program ...

Hmm... No, I'm writing VBScript.. I just want to make the IsAdmin funtion into an EXE that returns the same RC as the function. Then I will call that EXE from within my VBScript.

Link to comment
Share on other sites

  • Developers

Hmm... No, I'm writing VBScript.. I just want to make the IsAdmin funtion into an EXE that returns the same RC as the function. Then I will call that EXE from within my VBScript.

you mean an autoit3 compiled script return it ?

This should do that:

Return isAdmin()

Or use AutoIt3X ...

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

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