Re: export account details from an OU
- From: "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 14 Oct 2008 08:55:42 -0500
The script can be run on any computer authenticated to the domain. The
script creates the file Users.csv.
I would run it at a command prompt with the cscript host. For example, if
the script is saved in the file GetUsers.vbs (the file must have the *.vbs
extension), you can use the following command at a command prompt:
cscript GetUsers.vbs
This assumes you are in the folder where the file GetUsers.vbs is saved. If
not, you must specify the path and file name. The file Users.csv is created
in the same folder.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
"Cyborg" <apollo13@xxxxxxxxxxxxxx> wrote in message
news:CB09A36A-435E-42AB-941A-74060EFC3554@xxxxxxxxxxxxxxxx
Hi, where do I run this?
"Salvador Manaois III" <SalvadorManaoisIII@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote in message
news:C86D70BB-ED1B-4F37-A418-6024F8563EE1@xxxxxxxxxxxxxxxx
Please try this (queries all users under the "sales" OU and sub-OUs):
On Error Resume Next
Const ADS_SCOPE_SUBTREE = 2
Const FOR_WRITING = 2
outFile = ".\Users.csv"
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
Set objFSO = CreateObject("Scripting.FileSystemObject")
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT Name FROM 'LDAP://ou=sales,dc=fabrikam,dc=com' WHERE
objectCategory='user'"
Set objRecordSet = objCommand.Execute
Set objOut = objFSO.CreateTextFile(outFile, FOR_WRITING)
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("Name").Value
objOut.Writeline objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop
--
Salvador Manaois III
MCSE MCSA CEH MCITP | Enterprise/Server Admin
Bytes & Badz : http://badzmanaois.blogspot.com
"Cyborg" wrote:
Hi,
I need to export users from an OU to a CSV, this OU contains some more
OU's
that I also need the users exported from, how can I easiliy achieve
this?
Not sure if I can choose one OU and everything under this OU can be
exported?
Thanks
.
- References:
- export account details from an OU
- From: Cyborg
- RE: export account details from an OU
- From: Salvador Manaois III
- Re: export account details from an OU
- From: Cyborg
- export account details from an OU
- Prev by Date: Re: export account details from an OU
- Next by Date: Re: Servers that have been DC Promo'd still being queried
- Previous by thread: Re: export account details from an OU
- Next by thread: Help!! Replication issue requires DC reboot every 8 hours!!
- Index(es):
Relevant Pages
|