T
TJ_2006
Guest
Hi there,
Below is a script i pulled off the ms tech net i am having sereous
trouble using it, it gets a error on " Set OutPutFile =
FileSystem.CreateTextFile("marketing.txt", True)", it says there is an
invaled number of arguements when there isnt, if i change the dc=lan
to anything else i get the error "a referrel from the server was
made", which is what id expect considering the fully qualified domain
is etc.lan so nothing else will work.
is this a bug im confused id appreiate it if anyone can shed some
light on this
Regards James scammell
'Global variables
Dim oContainer
Dim OutPutFile
Dim FileSystem
'Initialize global variables
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("marketing.txt", True)
SetoContainer=GetObject("LDAP://OU=techies,DC=etc,DC=lan")
'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 (CN=joe)
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
Below is a script i pulled off the ms tech net i am having sereous
trouble using it, it gets a error on " Set OutPutFile =
FileSystem.CreateTextFile("marketing.txt", True)", it says there is an
invaled number of arguements when there isnt, if i change the dc=lan
to anything else i get the error "a referrel from the server was
made", which is what id expect considering the fully qualified domain
is etc.lan so nothing else will work.
is this a bug im confused id appreiate it if anyone can shed some
light on this
Regards James scammell
'Global variables
Dim oContainer
Dim OutPutFile
Dim FileSystem
'Initialize global variables
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("marketing.txt", True)
SetoContainer=GetObject("LDAP://OU=techies,DC=etc,DC=lan")
'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 (CN=joe)
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