Simply execute it in a console.
function einlesenAnwenderDaten (pUserID) {
//Verbindung mit ADS aufnehmen
var objDSE = GetObject("LDAP://rootDSE")
var objConnection = new ActiveXObject("ADODB.Connection");
objConnection.Provider = "ADsDSOObject"
objConnection.Open();
var objCommand = new ActiveXObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
//Directory nach userid durchsuchen
var strSQL = "SELECT cn, sn, givenname, title, telephoneNumber, mail,department,company " +
"FROM 'LDAP://" + objDSE.Get("defaultNamingContext") + "' " +
"WHERE objectCategory='person' and cn = '" + pUserID + "' ";
objCommand.CommandText = strSQL;
var adodbRecordSet = objCommand.Execute();
WScript.Echo(adodbRecordSet.RecordCount + " Datensätze gefunden.");
while (!adodbRecordSet.EOF) {
WScript.Echo("Noch kein EOF");
if (adodbRecordSet.Fields("cn")!=null) {
WScript.Echo("cn: "+adodbRecordSet.Fields("cn"));
}
if (adodbRecordSet.Fields("Company")!=null) {
WScript.Echo("Company: "+adodbRecordSet.Fields("Company"));
}
if (adodbRecordSet.Fields("department")!=null) {
WScript.Echo("department: "+adodbRecordSet.Fields("department"));
}
if (adodbRecordSet.Fields("givenname")!=null) {
WScript.Echo("givenname: "+adodbRecordSet.Fields("givenname"));
}
if (adodbRecordSet.Fields("mail")!=null) {
WScript.Echo("mail: "+adodbRecordSet.Fields("mail"));
}
adodbRecordSet.MoveNext();
}
}
einlesenAnwenderDaten("UGVNUM");
Keine Kommentare:
Kommentar veröffentlichen