דרוש סקריפט:

בעז 21

New member
דרוש סקריפט:

אני מחפש סקריפט שיוציא לי את כל הdisplay name של המשתמשים של בactive directory לקובץ. המטרה היא סריקה מלאה של הactive directory, וכניסה לכל OU, (באופן דינאמי כלומר אם אני יוצר OU חדש אז אין צורך לשנות משהו בscript .) בכל אופן הנה הסקריפט הנוכחי המכיל הכנסת display name של משתמשים לקובץ אך מOU ספציפי :
'Global variables Dim oContainer Dim OutPutFile Dim FileSystem 'Initialize global variables Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject") Set OutPutFile = FileSystem.CreateTextFile("test.txt", True) Set oContainer = GetObject("LDAP://OU=users,DC=test,DC=test") 'Enumerate Container EnumerateUsers oContainer 'Clean up OutPutFile.Close Set FileSystem = Nothing Set oContainer = Nothing WScript.Echo "Finished" WScript.Quit(0) Sub EnumerateUsers(oCont) Dim oUser For Each oUser In oCont Select Case LCase(oUser.Class) Case "user" If Not IsEmpty(oUser.distinguishedName) Then OutPutFile.WriteLine "dn: " & oUser.distinguishedName End If If Not IsEmpty(oUser.name) Then OutPutFile.WriteLine "name: " & oUser.Get ("name") End If 'need to do this because oUser.name would get back the Relative Distinguished name (i.e. CN=Jo Brown) If Not IsEmpty(oUser.st) Then OutPutFile.WriteLine "st: " & oUser.st End If If Not IsEmpty(oUser.streetAddress) Then OutPutFile.WriteLine "streetAddress: " & oUser.streetAddress End If Case "organizationalunit" , "container" EnumerateUsers oUser End Select OutPutFile.WriteLine Next End Sub​
 

בעז 21

New member
קבלו ביטול.

אין צורך, הסקריפט יודע לעשות את זה. בברכה בעז.
 

antidot

New member
ארוך מדי ../images/Emo3.gif

dsquery * -filter "&(objectCategory=person)(objectClass=user)" -limit 0 -attr samaccountname displayname Example: C:\>dsquery * -filter "&(objectCategory=person)(objectClass=user)" -limit 0 -attr samaccountname displayname samaccountname displayname Antid0t Teverovsky, Guy TsInternetUser TsInternetUser Administrator test test krbtgt up2date up2date netguru-root netguru-root plato-root plato-root junkmail junk mail bugzilla bugzilla IT-Takes IT Takes IUSR_DESCARTES Internet Guest Account IWAM_DESCARTES Launch IIS Process Account 5FD789D8-8EA2-448E-8 SystemMailbox{5FD789D8-8EA2-448E-832B-0FA3649433D4} User100 User100 User101 User101 User102 User102 User103 User103 User104 User104 User105 User105 User106 User106 User107 User107 User108 User108​
בשביל לייצא לקובץ:
dsquery * -filter "&(objectCategory=person)(objectClass=user)" -attr samaccountname displayname > users.txt​
 

antidot

New member
כי זה לא VBS

dsquery זאת פקודה בcommand line. קיימת ב2003 או XP אם התקנת support tools
 

antidot

New member
הםםם

ומה מונע ממך להתקין admin pack של 2003 ? זה שה-DC-ים 2000 לא אומר שלא ניתן לנהל אותם עם הכלים של 2003
 

TheJoCKeR

New member
../images/Emo51.gif לכולם.

הכל יבדק וינוסה במסגרת לימודיי לתואר ה MCSE הנכסף... מישהו יודע איפה אני יכול למצוא ריכוז חומר למבחנים שלא בתשלום ולא ב brain dumps (שבהם מצאתי הרבה שגיאות ב 98-99 לקראת (אז) תואר אדמין NT
טופי, קבל מסר...
 
למעלה