SMurphy Posted November 16, 2006 Share Posted November 16, 2006 (edited) 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 November 16, 2006 by SMurphy Link to comment Share on other sites More sharing options...
Developers Jos Posted November 16, 2006 Developers Share Posted November 16, 2006 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, SeanDid 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 More sharing options...
SMurphy Posted November 16, 2006 Author Share Posted November 16, 2006 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 More sharing options...
Developers Jos Posted November 16, 2006 Developers Share Posted November 16, 2006 (edited) 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 November 16, 2006 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 More sharing options...
SMurphy Posted November 16, 2006 Author Share Posted November 16, 2006 (edited) Okay... so, I created an AutoIT script... Return is IsAdmin() and it echos "ADMIN". So, the function appears to work, but when I complile it to an EXE, it's returning the wrong RC. Ideas? Edited November 16, 2006 by SMurphy Link to comment Share on other sites More sharing options...
Valik Posted November 17, 2006 Share Posted November 17, 2006 JdeB meant: Exit IsAdmin() Link to comment Share on other sites More sharing options...
Developers Jos Posted November 17, 2006 Developers Share Posted November 17, 2006 JdeB meant: Exit IsAdmin()yes... thats what i meant 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 More sharing options...
Valik Posted November 17, 2006 Share Posted November 17, 2006 If it's any consolation, I wish Return worked like that from global scope but it was deemed superfluous so I didn't bother implementing it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now