Jump to content

AD Objects in WinPE


powaking

Recommended Posts

Trying to get this autoit script to authenticate a password and group member in WinPE 2.0 (VistaPE)

$oMyError = ObjEvent("AutoIt.Error", "ComError")

$username = Inputbox("Username",'Enter your username',"","",200,100,-1,-1)
$password = Inputbox("Password",'Enter your password',"","*M",200,100,-1,-1)
$domain = ""
$group = ""

If Uservalidate($domain, $username, $password, $group) = 0 then
MsgBox(16 + 262144, "Error", "Try again", 8)
EndIf

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
Return 1
EndFunc ;==>UserValidate

Func ComError()
If IsObj($oMyError) Then
$HexNumber = Hex($oMyError.number, 8)
SetError($HexNumber)
Else
SetError(1)
EndIf
EndFunc ;==>ComError

Keep getting errors on ObjGet command.

Before I pull my hair out is this even possible in WinPE2.0 environment? Am I wasting my time? Is there another method?

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
  • Recently Browsing   0 members

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