Hi,
Habe das Problem, dass meine IF-Schleife bei einer Serverabfrage nicht mit der LDAP-Fehlerückmeldung klarkommt. Kriege immer nen ERROR:
Spoiler anzeigen
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Fileversion=1
#AutoIt3Wrapper_Res_Language=1031
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Klausurenmodus - Authentifizierung", 300, 200, 277, 397)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$inputUser = GUICtrlCreateInput("", 24, 50, 193, 21)
$inputPwd = GUICtrlCreateInput("", 24, 100, 193, 21, $ES_PASSWORD)
$Label2 = GUICtrlCreateLabel("Benutzername", 24, 30, 82, 17)
$Label3 = GUICtrlCreateLabel("Passwort", 24, 80, 56, 17)
$Button1 = GUICtrlCreateButton("OK", 52, 152, 121, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$user = GUICtrlRead($inputUser)
$pwd = GUICtrlRead($inputPwd)
ldap()
exit
EndSwitch
WEnd
Func ldap()
$strPfad = "LDAP://192.168.1.100/ou=Tim, dc=Ohburg, dc=BY, dc=de"
$strAdmin = "cn= " & $user & ", cn=Users, dc=Ohburg, dc=BY, dc=de"
$adsNamenraum = ObjGet("LDAP:")
$adsContainer = $adsNamenraum.openDSObject($strPfad,$strAdmin,$pwd,0)
if @exitCode 1 Then
MsgBox (0, "fehler", "fehler bei eingabe")
EndIf
For $adsUser in $adsContainer
$adsUser.accountDisabled=false
$adsuser.setinfo
Next
$strPfad = "LDAP://192.168.1.100/ou=Klausuren, dc=Ohburg, dc=BY, dc=de"
$strAdmin = "cn= " & $user &", cn=Users, dc=Ohburg, dc=BY, dc=de"
$adsNamenraum = ObjGet("LDAP:")
$adsContainer = $adsNamenraum.openDSObject($strPfad,$strAdmin,$pwd,0)
For $adsUser in $adsContainer
$adsUser.accountDisabled=true
$adsuser.setinfo
Next
endFunc