MadBoy Posted April 24, 2006 Share Posted April 24, 2006 I'll give it a try, just hopeing it will work What about the Last Logon value? And does it get replicated over domain or i have to ask all domain controlers about it? My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
MadBoy Posted April 24, 2006 Share Posted April 24, 2006 I must say i have hard time implementing your code in my code ;p It always exists and nothing happens. Even if i just check your script it always ends up with nothing. Added msgbox but it doesn't apear. And i was thinking about it. If i Run it like that for Domain/User list i will have to change credentials back to Administrator to change local stuff like "rename computer" or Add to Local Administrators domain account? Or it will work without problems? $Domain = "somedomain" ; Check for special tasks If $cmdline[0] > 0 Then If $cmdline[1] = "/ADAdmincheck" Then $rc = UserValidate($Domain, $cmdline[1], $cmdline[2], "") Exit $rc EndIf EndIf ; Ask for login/password $UserName = "some" $Password = "something" ; Rerun this script under the provided credentials to check if part of admin group. Opt("RunErrorsFatal", 0) RunAsSet($UserName, $Domain, $Password) If Not RunWait(@ScriptFullPath & " /ADAdmincheck " & $UserName & " " & $Password) Then Exit ; MsgBox(1,1,"Little Test - Shit") ; Func UserValidate($Domain, $UserName, $Password, $InGroup = "") Local $NameSpace = ObjGet("WinNT:") Local $ADS_SECURE_AUTHENTICATION = 0x0001 Local $DomObj = $NameSpace.OpenDSObject ("WinNT://" & $Domain, $UserName, $Password, $ADS_SECURE_AUTHENTICATION) If @error <> 0 Then Return 0 If $InGroup <> "" Then $objUser = ObjGet("WinNT://" & $Domain & "/" & $UserName) For $oGroup In $objUser.Groups If $oGroup.Name = $InGroup Then Return 1 EndIf Next Return 0 EndIf Return 1 EndFunc ;==>UserValidate My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
Developers Jos Posted April 24, 2006 Developers Share Posted April 24, 2006 (edited) I must say i have hard time implementing your code in my code ;p It always exists and nothing happens. Forgot to mention it will only work when you compile the script and run the exe.And i assume you will change it to use a proper userid and password and ofcourse adapt the test for the admin group.. else it will just exit..... Edited April 24, 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...
MadBoy Posted April 24, 2006 Share Posted April 24, 2006 Forgot to mention it will only work when you compile the script and run the exe.And i assume you will change it to use a proper userid and password and ofcourse adapt the test for the admin group.. else it will just exit.....Ah exe The others i did know My little company: Evotec (PL version: Evotec) 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