Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Exporting user info

Reply
Thread Tools Display Modes

Exporting user info

 
 
Glenn Clark
Guest
Posts: n/a

 
      10-10-2008
Hi All

I am about to do an upgrade form sbs2000 to 2003 and need to export AD user
data. I have managed to find a script which tells me all the email addresses
but I need to export a full list of users which tell me their drive letter
and location for mapped home folder and what login script is set for them.
Is there an easy way I can get this information exported

Many thanks

Glenn


 
Reply With Quote
 
 
 
 
Meinolf Weber
Guest
Posts: n/a

 
      10-10-2008
Hello Glenn,

I strongly recommend to post to:
microsoft.public.windows.server.sbs

I think you can do a kind of inplace upgrade, but ask there, you have the
SBS experts in that NG.

Best regards

Meinolf Weber
Disclaimer: This posting is provided "AS IS" with no warranties, and confers
no rights.
** Please do NOT email, only reply to Newsgroups
** HELP us help YOU!!! http://www.blakjak.demon.co.uk/mul_crss.htm


> Hi All
>
> I am about to do an upgrade form sbs2000 to 2003 and need to export AD
> user data. I have managed to find a script which tells me all the
> email addresses but I need to export a full list of users which tell
> me their drive letter and location for mapped home folder and what
> login script is set for them. Is there an easy way I can get this
> information exported
>
> Many thanks
>
> Glenn
>



 
Reply With Quote
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      10-10-2008

"Glenn Clark" <> wrote in message
news:...
> Hi All
>
> I am about to do an upgrade form sbs2000 to 2003 and need to export AD
> user data. I have managed to find a script which tells me all the email
> addresses but I need to export a full list of users which tell me their
> drive letter and location for mapped home folder and what login script is
> set for them. Is there an easy way I can get this information exported
>
> Many thanks
>
> Glenn
>


The attribute values you refer to are homeDrive, homeDirectory, and
scriptPath. You also want distinguishedName (or DN) and sAMAccountName
(pre-Windows 2000 logon name). You can use Joe Richards' free adfind command
line utility to export these values for all users.

http://www.joeware.net/freetools/tools/adfind/index.htm

You could also use the command line tools dsquery and dsget. Otherwise, the
following VBScript program outputs the values for all users. It should be
run at a command prompt with the output redirected to a text file. For
example, if the code is saved in a text file called GetUsers.vbs, you could
use the command:

cscript //nologo GetUsers.vbs > report.csv

This assumes you are in the folder were GetUsers.vbs is saved. Otherwise,
you must also specify the path to the *.vbs file. The output is saved in
report.csv, which can be read into a spreadsheet. The VBScript program
follows:
=========
Option Explicit

Dim objRootDSE, strDNSDomain, adoCommand, adoConnection
Dim strBase, strFilter, strAttributes, strQuery, adoRecordset
Dim strDN, strNTName, strHomeDir, strHomeDrive, strScript
Dim arrAttrValues

' Determine DNS domain name.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")

' Use ADO to search Active Directory.
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection

' Search entire domain.
strBase = "<LDAP://" & strDNSDomain & ">"

' Search for all users.
strFilter = "(&(objectCategory=person)(objectClass=user))"

' Comma delimited list of attribute values to retrieve.
strAttributes = "distinguishedName,sAMAccountName," _
& "homeDirectory,homeDrive,scriptPath"

' Construct the LDAP query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"

' Run the query.
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
Set adoRecordset = adoCommand.Execute

' Output heading line.
Wscript.Echo """Distinguished Name"",""NT Name"",""Home Directory""," _
& """Home Drive"",""Logon Script"""

' Enumerate the resulting recordset.
Do Until adoRecordset.EOF
' Retrieve single-valued strings.
strDN = adoRecordset.Fields("distinguishedName").Value
strNTName = adoRecordset.Fields("sAMAccountName").Value
strHomeDir = adoRecordset.Fields("homeDirectory").Value
strHomeDrive = adoRecordset.Fields("homeDrive").Value
strScript = adoRecordset.Fields("scriptPath").Value

' Create array of string values to display.
arrAttrValues = Array(strDN, strNTName, strHomeDir, _
strHomeDrive, strScript)

' Display array of values in a comma delimited line, with each
' value enclosed in quotes.
Wscript.Echo CSVLine(arrAttrValues)

' Move to next record in recordset.
adoRecordset.MoveNext
Loop

' Clean up.
adoRecordset.Close
adoConnection.Close

Function CSVLine(ByVal arrValues)
' Function to convert array of values into comma delimited
' values enclosed in quotes.
Dim strItem

CSVLine = ""
For Each strItem In arrValues
' Replace any embedded quotes with two quotes.
If (strItem <> "") Then
strItem = Replace(strItem, """", """" & """")
End If
' Append string values, enclosed in quotes,
' delimited by commas.
If (CSVLine = "") Then
CSVLine = """" & strItem & """"
Else
CSVLine = CSVLine & ",""" & strItem & """"
End If
Next

End Function
=========
If you have Exchange, email addresses are in the multi-valued attribute
proxyAddresses. This can also be exported, but you say you have already have
a script that does this. Email addresses can also be in the mail attribute.
The above script is based on the following example, which also shows how to
handle multi-valued attributes (like proxyAddresses):

http://www.rlmueller.net/DocumentUsers.htm

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


 
Reply With Quote
 
Glenn Clark
Guest
Posts: n/a

 
      10-10-2008
Thanks that's brilliant

Glenn

"Richard Mueller [MVP]" <rlmueller-> wrote in
message news:...
>
> "Glenn Clark" <> wrote in
> message news:...
>> Hi All
>>
>> I am about to do an upgrade form sbs2000 to 2003 and need to export AD
>> user data. I have managed to find a script which tells me all the email
>> addresses but I need to export a full list of users which tell me their
>> drive letter and location for mapped home folder and what login script is
>> set for them. Is there an easy way I can get this information exported
>>
>> Many thanks
>>
>> Glenn
>>

>
> The attribute values you refer to are homeDrive, homeDirectory, and
> scriptPath. You also want distinguishedName (or DN) and sAMAccountName
> (pre-Windows 2000 logon name). You can use Joe Richards' free adfind
> command line utility to export these values for all users.
>
> http://www.joeware.net/freetools/tools/adfind/index.htm
>
> You could also use the command line tools dsquery and dsget. Otherwise,
> the following VBScript program outputs the values for all users. It should
> be run at a command prompt with the output redirected to a text file. For
> example, if the code is saved in a text file called GetUsers.vbs, you
> could use the command:
>
> cscript //nologo GetUsers.vbs > report.csv
>
> This assumes you are in the folder were GetUsers.vbs is saved. Otherwise,
> you must also specify the path to the *.vbs file. The output is saved in
> report.csv, which can be read into a spreadsheet. The VBScript program
> follows:
> =========
> Option Explicit
>
> Dim objRootDSE, strDNSDomain, adoCommand, adoConnection
> Dim strBase, strFilter, strAttributes, strQuery, adoRecordset
> Dim strDN, strNTName, strHomeDir, strHomeDrive, strScript
> Dim arrAttrValues
>
> ' Determine DNS domain name.
> Set objRootDSE = GetObject("LDAP://RootDSE")
> strDNSDomain = objRootDSE.Get("defaultNamingContext")
>
> ' Use ADO to search Active Directory.
> Set adoCommand = CreateObject("ADODB.Command")
> Set adoConnection = CreateObject("ADODB.Connection")
> adoConnection.Provider = "ADsDSOObject"
> adoConnection.Open "Active Directory Provider"
> adoCommand.ActiveConnection = adoConnection
>
> ' Search entire domain.
> strBase = "<LDAP://" & strDNSDomain & ">"
>
> ' Search for all users.
> strFilter = "(&(objectCategory=person)(objectClass=user))"
>
> ' Comma delimited list of attribute values to retrieve.
> strAttributes = "distinguishedName,sAMAccountName," _
> & "homeDirectory,homeDrive,scriptPath"
>
> ' Construct the LDAP query.
> strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
>
> ' Run the query.
> adoCommand.CommandText = strQuery
> adoCommand.Properties("Page Size") = 100
> adoCommand.Properties("Timeout") = 30
> adoCommand.Properties("Cache Results") = False
> Set adoRecordset = adoCommand.Execute
>
> ' Output heading line.
> Wscript.Echo """Distinguished Name"",""NT Name"",""Home Directory""," _
> & """Home Drive"",""Logon Script"""
>
> ' Enumerate the resulting recordset.
> Do Until adoRecordset.EOF
> ' Retrieve single-valued strings.
> strDN = adoRecordset.Fields("distinguishedName").Value
> strNTName = adoRecordset.Fields("sAMAccountName").Value
> strHomeDir = adoRecordset.Fields("homeDirectory").Value
> strHomeDrive = adoRecordset.Fields("homeDrive").Value
> strScript = adoRecordset.Fields("scriptPath").Value
>
> ' Create array of string values to display.
> arrAttrValues = Array(strDN, strNTName, strHomeDir, _
> strHomeDrive, strScript)
>
> ' Display array of values in a comma delimited line, with each
> ' value enclosed in quotes.
> Wscript.Echo CSVLine(arrAttrValues)
>
> ' Move to next record in recordset.
> adoRecordset.MoveNext
> Loop
>
> ' Clean up.
> adoRecordset.Close
> adoConnection.Close
>
> Function CSVLine(ByVal arrValues)
> ' Function to convert array of values into comma delimited
> ' values enclosed in quotes.
> Dim strItem
>
> CSVLine = ""
> For Each strItem In arrValues
> ' Replace any embedded quotes with two quotes.
> If (strItem <> "") Then
> strItem = Replace(strItem, """", """" & """")
> End If
> ' Append string values, enclosed in quotes,
> ' delimited by commas.
> If (CSVLine = "") Then
> CSVLine = """" & strItem & """"
> Else
> CSVLine = CSVLine & ",""" & strItem & """"
> End If
> Next
>
> End Function
> =========
> If you have Exchange, email addresses are in the multi-valued attribute
> proxyAddresses. This can also be exported, but you say you have already
> have a script that does this. Email addresses can also be in the mail
> attribute. The above script is based on the following example, which also
> shows how to handle multi-valued attributes (like proxyAddresses):
>
> http://www.rlmueller.net/DocumentUsers.htm
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Explorer application errors nemmens Windows Server 6 06-05-2008 10:24 AM
User last logon info on a domain Phil McNeill Windows Server 3 01-19-2008 03:34 AM
Cluster Nodes Not Failing Over - Physical Disk Resource gtlscot Windows Server 2 04-24-2007 08:12 PM
I cannot successfully install windows xp x64 Andreas Buhler Windows 64 Bit 8 02-11-2006 03:38 PM
ACL Permissions John Pugh Windows Server 7 12-20-2004 07:09 PM



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 58 59