Hallo Zusammen
Kann mir hierbei jemand bitte einen Tip geben weshalb ich keine AD Member informationen bekomme?, es wird auch kein ArrayDisplay angezeigt.Server 2008 R2.
Danke für jeden Tip oder verbesserung
MC
Spoiler anzeigen
#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#Include <ad.au3>
#Include <File.au3>
Global $sFile, $TextFileName, $username
; Open Connection to the Active Directory
_AD_Open()
$username = InputBox("Username", "Der Benutzername wird gleich aus dem AD gesucht")
MsgBox(64,"Username ist;", $username)
;Global $aOUs =
$aGroups = _AD_GetUserGroups("CN="& $username &",OU=Intern,OU=Users,OU=LLL,DC=LLL-Lusanne,DC=local", 1)
_ArrayDisplay($aGroups)
$sFile = @ScriptDir & "_benutzername aus array.txt"
[/autoit] [autoit][/autoit] [autoit]_AD_Close()
[/autoit][AD.AU3] - Nur _GetUserGroups wurde ausgeschniten
Spoiler anzeigen
; #FUNCTION# ====================================================================================================================
; Name...........: _AD_GetUserGroups
; Description ...: Returns an array of group names that the user is immediately a member of.
; Syntax.........: _AD_GetUserGroups([$sAD_User = @UserName[, $fAD_IncludePrimaryGroup = 0]])
; Parameters ....: $sAD_User - Optional: User for which the group membership is to be returned (default = @Username). Can be specified as Fully Qualified Domain Name (FQDN) or sAMAccountName
; $fAD_IncludePrimaryGroup - Optional: include the primary group to the return list (default = 0)
; Return values .: Success - One-based one dimensional array of group names (FQDN) the user is a member of
; Failure - "", sets @error to:
; |1 - Specified user does not exist
; Author ........: Jonathan Clelland
; Modified.......: water
; Remarks .......: Works for computers or groups as well.
; Related .......: _AD_IsMemberOf, _AD_GetUserPrimaryGroup, _AD_RecursiveGetMemberOf
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _AD_GetUserGroups($sAD_User = @UserName, $fAD_IncludePrimaryGroup = 0)
If _AD_ObjectExists($sAD_User) = 0 Then Return SetError(1, 0, "")
Local $sAD_Property = "sAMAccountName"
If StringMid($sAD_User, 3, 1) = "=" Then $sAD_Property = "distinguishedName" ; FQDN provided
Local $sAD_Query = "<LDAP://" & $sAD_HostServer & "/" & $sAD_DNSDomain & ">;(" & $sAD_Property & "=" & $sAD_User & ");ADsPath;subtree"
Local $oAD_RecordSet = $oAD_Connection.Execute($sAD_Query) ; Retrieve the FQDN for the logged on user
Local $sAD_LDAPEntry = $oAD_RecordSet.fields(0).value
Local $oAD_Object = _AD_ObjGet($sAD_LDAPEntry) ; Retrieve the COM Object for the logged on user
Local $aAD_Groups = $oAD_Object.GetEx("memberof")
If $fAD_IncludePrimaryGroup Then _ArrayAdd($aAD_Groups, _AD_GetUserPrimaryGroup($sAD_User))
_ArrayInsert($aAD_Groups, 0, UBound($aAD_Groups))
Return $aAD_Groups
EndFunc ;==>_AD_GetUserGroups
Ansonst hier der Link zum File: http://www.autoitscript.com/forum/index.php?app=core&module=attach§ion=attach&attach_id=32668