Guten morgen,
ich habe gestern von unseren oberen Server fuzzies nen vbs script bekommen um paar LDAP sachen zu zu lesen die ich benötige ....
Ich bin schon soweit, das ich mit das ADO teil ins form gezogen hbe mich per ms ole für directory services auf den AD server geklickt habe ...
nun muss ich nur noch an die entsprechenden werte kommen.
nur irgendwie habe ich da noch keine ahnung wo ich anfangen soll.
ich gebe euch mal nen auszug ausm qulltext des scriptes ...
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57:
| 'Define variables Dim conn Dim command Dim rs Dim objArgs Dim NoGroups Dim objNetwork
'Get active User Set objNetwork = CreateObject("Wscript.Network") txtUserID = objNetwork.UserName txtDomain = objNetwork.UserDomain
'**Start Encode**
'Query the Global Catalog to find the user or group, Set conn = CreateObject("ADODB.Connection") conn.Provider = "ADsDSOObject" conn.open "DS Query"
set command=CreateObject("ADODB.Command") set command.ActiveConnection = conn command.CommandText = "<GC://dc=domain,DC=tld>;(cn="& txtUserID & ");cn,AdsPath;subTree"
set rs=CreateObject("ADODB.Recordset") set rs=command.execute
If rs.RecordCount <> 1 Then WScript.Echo "User could not be found." WScript.Quit End If
sUser=replace(rs("AdsPath"),"GC://","") Set objUser=GetObject("LDAP://SERVER/" & sUser) If Err.Number <> 0 Then MsgBox err.number End If '**Stop Encode**
txtOutput = "Username : " & txtUserID & vbCrLf txtOutput = txtOutput & "Display Name: " & objUser.displayName & vbCrLf txtOutput = txtOutput & "Description : " & objUser.Description & vbCrLf txtOutput = txtoutput & "Department : " & objUser.department & vbCrLf txtOutput = txtOutput & "Domain: " & txtDomain & vbCrLf txtOutput = txtOutput & "mail : " & objUser.mail & vbCrLf txtOutput = txtOutput & "Home Drive: " & objUser.homeDrive & vbCrLf txtOutput = txtOutput & "Home Drive Path: " & objUser.homeDirectory & vbCrLf txtOutput = txtOutput & "Telefon : " & objUser.telephoneNumber & vbCrLf txtOutput = txtOutput & "Kostenstelle : " & objUser.rocheLocalCostCenter
MsgBox txtOutput
Set objNetwork=Nothing Set conn=Nothing Set command=Nothing Set rs=Nothing |
also diese doofe msg box will ich natuerlich nicht sondern schon da oben die objUser daten in Edit fields schmeissen...
kann mir wer etwas auf die sprünge helfen ?