Roger
Wed Dec 24 11:21:22 CST 2003
This is a multi-part message in MIME format.
------=_NextPart_000_0053_01C3CA10.0F6D1380
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Thanks for your quick response Richard. You've already been more help =
than should be allowed. In fact, most of the following code is yours.
Can you please tell me where to put the function, based on the code =
below to return the parsed DN to get the parent container.
Sorry but I'm dense when it comes to this, I just learning this stuff.
Please note in bold below where I've put it and it doesn't work. I'm =
sure you'll look at it and laugh.
Thanks,
Roger
Option Explicit
Dim strExcelPath, objConnection, objCommand, objRootDSE, strDNSDomain, =
strADsPath
Dim strFilter, strQuery, objRecordSet, strDN, strUserDN, strCN, strOU, =
strParentOU, strUPN, strSAM, objExcel, objSheet, k
Dim oADsSysInfo, oADsContainer, sADsUser, sUserPath, sUserOU
' Check for required arguments.
If Wscript.Arguments.Count < 1 Then
Wscript.Echo "Arguments <FileName> required. For example:" & vbCrLf _
& "wscript CreateUserList3.vbs d:\ADUsers\UserList3.xls"
Wscript.Quit(0)
End If
' Spreadsheet file to be created.
strExcelPath =3D Wscript.Arguments(0)
' Bind to Excel object.
Set objExcel =3D CreateObject("Excel.Application")
objExcel.Workbooks.Add
' Bind to worksheet.
Set objSheet =3D objExcel.ActiveWorkbook.Worksheets(1)
objSheet.Name =3D "Domain Users"
objSheet.Cells(1, 1).Value =3D "User Distinguished Name"
objSheet.Cells(1, 2).Value =3D "User cn"
objSheet.Cells(1, 3).Value =3D "User OU Container"
objSheet.Cells(1, 4).Value =3D "User userPrincipalName"
objSheet.Cells(1, 5).Value =3D "User sAMAccountName"
' Use ADO to search the domain for all users.
Set objConnection =3D CreateObject("ADODB.Connection")
Set objCommand =3D CreateObject("ADODB.Command")
objConnection.Provider =3D "ADsDSOOBject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection =3D objConnection
' Determine the DNS domain from the RootDSE object.
Set objRootDSE =3D GetObject("LDAP://RootDSE")
' Code for finding parent object of user
' Connect to the LDAP server's root object
'Set oADsRootDSE =3D GetObject("LDAP://RootDSE")
Set oADsSysInfo =3D CreateObject("ADSystemInfo")
' Get distinguished name of the current user
sADsUser =3D oADsSysInfo.UserName
'WScript.Echo "Distinguished name: " & sADsUser
' Get user object
sUserPath =3D "LDAP://" & sADsUser
Set oADsContainer =3D GetObject(sUserPath)
sUserOU =3D oADsContainer.parent
'WScript.Echo "Users OU: " & sUserOU
' Get full name of the current user
'sUserNameFull =3D oADsContainer.cn
'WScript.Echo "Full name: " & sUserNameFull
strDNSDomain =3D objRootDSE.Get("defaultNamingContext")
strFilter =3D "(&(objectCategory=3Dperson)(objectClass=3Duser))"
strQuery =3D "<LDAP://" & strDNSDomain & ">;" & strFilter _
& ";distinguishedName,cn,userPrincipalName,sAMAccountName;subtree"
=20
objCommand.CommandText =3D strQuery
objCommand.Properties("Page Size") =3D 100
objCommand.Properties("Timeout") =3D 30
objCommand.Properties("Cache Results") =3D False
objCommand.Properties("Sort On") =3D "userPrincipalName"
' Enumerate all users. Write each user's Distinguished Name to the
' spreadsheet.
k =3D 2
Set objRecordSet =3D objCommand.Execute
Do Until objRecordSet.EOF
Function ParseOU(strDN)
ParseOU =3D Mid(strDN, InStr(strDN, "=3D") + 1)
ParseOU =3D Mid(ParseOU, InStr(ParseOU, "=3D") - 2)
End Function
strDN =3D objRecordSet.Fields("distinguishedName")
strCN =3D objRecordSet.Fields("cn")
strOU =3D objRecordSet.Fields("ParseOU")
strUPN =3D objRecordSet.Fields("userPrincipalName")
strSAM =3D objRecordSet.Fields("sAMAccountName")
objSheet.Cells(k, 1).Value =3D strDN
objSheet.Cells(k, 2).Value =3D strCN
objSheet.Cells(k, 3).Value =3D strOU
objSheet.Cells(k, 4).Value =3D strUPN
objSheet.Cells(k, 5).Value =3D strSAM
k =3D k + 1
objRecordSet.MoveNext
Loop
' Format the spreadsheet.
objSheet.Range("A1:E1").Font.Bold =3D True
objSheet.Select
objExcel.Columns(5).ColumnWidth =3D 100
' Save the spreadsheet.
objExcel.ActiveWorkbook.SaveAs strExcelPath
objExcel.ActiveWorkbook.Close
' Quit Excel.
objExcel.Application.Quit
' Clean up.
objConnection.Close
Set objConnection =3D Nothing
Set objCommand =3D Nothing
Set objRootDSE =3D Nothing
Set objRecordSet =3D Nothing
Set objSheet =3D Nothing
Set objExcel =3D Nothing
Wscript.Echo "Done"
"Richard Mueller [MVP]" <rlmueller-NOSPAM@ameritech.NOSPAM.net> wrote =
in message news:OJYYF5jyDHA.832@TK2MSFTNGP09.phx.gbl...
Hi,
Unfortunately, only Organizational Units have a mandatory "ou" =
attribute. And, "Parent" is a property method of the user object, not an =
attribute, so it cannot be retrieved directly with an ADO query. =
Instead, you will have to parse the distinguishedName (DN) attribute, or =
bind to the user object and use the "Parent" property method. It would =
be faster to parse the DN. For example, this function would parse a DN =
and return the Distinguished Name of the parent container/ou.
Function ParseOU(strDN)
ParseOU =3D Mid(strDN, InStr(strDN, "=3D") + 1)
ParseOU =3D Mid(ParseOU, InStr(ParseOU, "=3D") - 2)
End Function
If you are using ADO to retrieve information on all users in your =
domain, you can use this function in the loop where you enumerate the =
records returned by the query.
Actually, user objects have an "ou" attribute, but it is never has a =
value.
--=20
Richard
Microsoft MVP Scripting and ADSI
HilltopLab web site -
http://www.rlmueller.net
--
"Roger" <hainesr3@nationwide.com> wrote in message =
news:OVudKziyDHA.540@tk2msftngp13.phx.gbl...
Does anyone know how I can include the users parent container from =
the following script? The "ou" portion (in BLACK) is where I was trying =
to gather that, but it doesn't work.
strDNSDomain =3D objRootDSE.Get("defaultNamingContext")
strFilter =3D "(&(objectCategory=3Dperson)(objectClass=3Duser))"
strQuery =3D "<LDAP://" & strDNSDomain & ">;" & strFilter _
& =
";distinguishedName,cn,ou,userPrincipalName,sAMAccountName;subtree"
The script below returns exactly what I'm looking for however, I =
can't figure out how to incorporate in into the query. I'm trying to =
populate
a spreadsheet with the information that is returned from the =
"sUserOU" variable.
' Connect to the LDAP server's root object
Set oADsRootDSE =3D GetObject("LDAP://RootDSE")
Set oADsSysInfo =3D CreateObject("ADSystemInfo")
' Get distinguished name of the current user
sADsUser =3D oADsSysInfo.UserName
WScript.Echo "Distinguished name: " & sADsUser
' Get user object
sUserPath =3D "LDAP://" & sADsUser
Set oADsContainer =3D GetObject(sUserPath)
sUserOU =3D oADsContainer.parent
WScript.Echo "Users OU: " & sUserOU
' Get full name of the current user
sUserNameFull =3D oADsContainer.cn
WScript.Echo "Full name: " & sUserNameFull
Here is the format that the results are returned.
Distinguished name: =
CN=3DPRH007,OU=3DAccounts,OU=3DSales,DC=3Dmydomain,DC=3Dnet
Users OU: LDAP://OU=3DAccounts,OU=3DSales,DC=3Dmydomain,DC=3Dnet
Full name: PRH007
Thanks,
Roger
------=_NextPart_000_0053_01C3CA10.0F6D1380
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1264" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Thanks for your quick response =
Richard. =20
You've already been more help than should be allowed. In fact, =
most of the=20
following code is yours.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Can you please tell me where to put the =
function,=20
based on the code below to return the parsed DN to get the parent=20
container.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Sorry but I'm dense when it comes to =
this, I just=20
learning this stuff.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Please note in bold below where I've =
put it and it=20
doesn't work. I'm sure you'll look at it and laugh.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Roger</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Option Explicit</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Dim strExcelPath, objConnection, =
objCommand,=20
objRootDSE, strDNSDomain, strADsPath<BR>Dim strFilter, strQuery, =
objRecordSet,=20
strDN, strUserDN, strCN, strOU, strParentOU, strUPN, strSAM, objExcel, =
objSheet,=20
k<BR>Dim oADsSysInfo, oADsContainer, sADsUser, sUserPath, =
sUserOU</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>' Check for required arguments.<BR>If=20
Wscript.Arguments.Count < 1 Then<BR> Wscript.Echo "Arguments=20
<FileName> required. For example:" & vbCrLf =
_<BR> =20
& "wscript CreateUserList3.vbs d:\ADUsers\UserList3.xls"<BR> =20
Wscript.Quit(0)<BR>End If</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>' Spreadsheet file to be =
created.<BR>strExcelPath =3D=20
Wscript.Arguments(0)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>' Bind to Excel object.<BR>Set objExcel =
=3D=20
CreateObject("Excel.Application")<BR>objExcel.Workbooks.Add</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>' Bind to worksheet.<BR>Set objSheet =
=3D=20
objExcel.ActiveWorkbook.Worksheets(1)<BR>objSheet.Name =3D "Domain=20
Users"<BR>objSheet.Cells(1, 1).Value =3D "User Distinguished=20
Name"<BR>objSheet.Cells(1, 2).Value =3D "User cn"<BR>objSheet.Cells(1, =
3).Value =3D=20
"User OU Container"<BR>objSheet.Cells(1, 4).Value =3D "User=20
userPrincipalName"<BR>objSheet.Cells(1, 5).Value =3D "User=20
sAMAccountName"</FONT></DIV>
<DIV> </DIV>
<DIV><BR><FONT face=3DArial size=3D2>' Use ADO to search the domain for =
all=20
users.<BR>Set objConnection =3D CreateObject("ADODB.Connection")<BR>Set =
objCommand=20
=3D CreateObject("ADODB.Command")<BR>objConnection.Provider =3D=20
"ADsDSOOBject"<BR>objConnection.Open "Active Directory Provider"<BR>Set=20
objCommand.ActiveConnection =3D objConnection</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>' Determine the DNS domain from the =
RootDSE=20
object.<BR>Set objRootDSE =3D GetObject("</FONT><A =
href=3D"ldap://RootDSE"><FONT=20
face=3DArial size=3D2>LDAP://RootDSE</FONT></A><FONT face=3DArial=20
size=3D2>")</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>' Code f
r finding parent object of =
user<BR>'=20
Connect to the LDAP server's root object<BR>'Set oADsRootDSE =3D=20
GetObject("</FONT><A href=3D"ldap://RootDSE"><FONT face=3DArial=20
size=3D2>LDAP://RootDSE</FONT></A><FONT face=3DArial =
size=3D2>")</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Set oADsSysInfo =3D=20
CreateObject("ADSystemInfo")</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>' Get distinguished name of the current =
user<BR>sADsUser =3D oADsSysInfo.UserName<BR>'WScript.Echo =
"Distinguished name: "=20
& sADsUser</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>' Get user object<BR>sUserPath =3D =
"LDAP://" &=20
sADsUser<BR>Set oADsContainer =3D GetObject(sUserPath)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>sUserOU =3D =
oADsContainer.parent<BR>'WScript.Echo=20
"Users OU: " & sUserOU</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>' Get full name of the current=20
user<BR>'sUserNameFull =3D oADsContainer.cn<BR>'WScript.Echo "Full name: =
" &=20
sUserNameFull</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>strDNSDomain =3D=20
objRootDSE.Get("defaultNamingContext")<BR>strFilter =3D=20
"(&(objectCategory=3Dperson)(objectClass=3Duser))"<BR>strQuery =3D =
"<LDAP://"=20
& strDNSDomain & ">;" & strFilter _<BR> &=20
";distinguishedName,cn,userPrincipalName,sAMAccountName;subtree"<BR> =
;=20
<BR>objCommand.CommandText =3D strQuery<BR>objCommand.Properties("Page =
Size") =3D=20
100<BR>objCommand.Properties("Timeout") =3D =
30<BR>objCommand.Properties("Cache=20
Results") =3D False<BR>objCommand.Properties("Sort On") =3D=20
"userPrincipalName"</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>' Enumerate all users. Write each =
user's=20
Distinguished Name to the<BR>' spreadsheet.<BR>k =3D 2<BR>Set =
objRecordSet =3D=20
objCommand.Execute<BR>Do Until objRecordSet.EOF</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2><STRONG>Function=20
ParseOU(strDN)<BR> ParseOU =3D Mid(strDN, InStr(strDN, "=3D") + =
1)<BR> =20
ParseOU =3D Mid(ParseOU, InStr(ParseOU, "=3D") - 2)<BR>End=20
Function</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><BR><FONT face=3DArial size=3D2> strDN =3D=20
objRecordSet.Fields("distinguishedName")<BR> strCN =3D=20
objRecordSet.Fields("cn")<BR> strOU =3D objRecordSet.Fields("<FONT =
color=3D#ff0000><STRONG>ParseOU</STRONG></FONT>")<BR> strUPN =3D=20
objRecordSet.Fields("userPrincipalName")<BR> strSAM =3D=20
objRecordSet.Fields("sAMAccountName")<BR> objSheet.Cells(k, =
1).Value =3D=20
strDN<BR> objSheet.Cells(k, 2).Value =3D strCN<BR> =
objSheet.Cells(k,=20
3).Value =3D strOU<BR> objSheet.Cells(k, 4).Value =3D =
strUPN<BR> =20
objSheet.Cells(k, 5).Value =3D strSAM<BR> k =3D k + 1<BR> =20
objRecordSet.MoveNext<BR>Loop</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>' Format the=20
spreadsheet.<BR>objSheet.Range("A1:E1").Font.Bold =3D=20
True<BR>objSheet.Select<BR>objExcel.Columns(5).ColumnWidth =3D =
100</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>' Save the=20
spreadsheet.<BR>objExcel.ActiveWorkbook.SaveAs=20
strExcelPath<BR>objExcel.ActiveWorkbook.Close</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>' Quit=20
Excel.<BR>objExcel.Application.Quit</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>' Clean =
up.<BR>objConnection.Close<BR>Set=20
objConnection =3D Nothing<BR>Set objCommand =3D Nothing<BR>Set =
objRootDSE =3D=20
Nothing<BR>Set objRecordSet =3D Nothing<BR>Set objSheet =3D =
Nothing<BR>Set objExcel=20
=3D Nothing</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Wscript.Echo "Done"</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Richard Mueller [MVP]" <<A=20
=
href=3D"mailto:rlmueller-NOSPAM@ameritech.NOSPAM.net">rlmueller-NOSPAM@am=
eritech.NOSPAM.net</A>>=20
wrote in message <A=20
=
href=3D"news:OJYYF5jyDHA.832@TK2MSFTNGP09.phx.gbl">news:OJYYF5jyDHA.832@T=
K2MSFTNGP09.phx.gbl</A>...</DIV>
<DIV><FONT size=3D2>Hi,</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Unfortunately, only Organizational Units have a =
mandatory=20
"ou" attribute. And, "Parent" is a property method of the user object, =
not an=20
attribute, so it cannot be retrieved directly with an ADO query. =
Instead, you=20
will have to parse the distinguishedName (DN) attribute, or bind =
to the=20
user object and use the "Parent" property method. It would be faster =
to parse=20
the DN. For example, this function would parse a DN and return the=20
Distinguished Name of the parent container/ou.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Function ParseOU(strDN)</FONT></DIV>
<DIV><FONT size=3D2> ParseOU =3D Mid(strDN, InStr(strDN, "=3D") =
+=20
1)</FONT></DIV>
<DIV><FONT size=3D2> ParseOU =3D Mid(ParseOU, InStr(ParseOU, =
"=3D") -=20
2)</FONT></DIV>
<DIV><FONT size=3D2>End Function</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>If you are using ADO to retrieve information on =
all users in=20
your domain, you can use this function in the loop where you enumerate =
the=20
records returned by the query.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2>Actually, user objects have an "ou" attribute, but =
it is=20
never has a value.</FONT></DIV>
<DIV><FONT size=3D2><BR>-- <BR>Richard<BR>Microsoft MVP Scripting and=20
ADSI<BR>HilltopLab web site - <A=20
=
href=3D"
http://www.rlmueller.net">http://www.rlmueller.net</A><BR>--</FON=
T></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Roger" <<A=20
=
href=3D"mailto:hainesr3@nationwide.com">hainesr3@nationwide.com</A>> =
wrote=20
in message <A=20
=
href=3D"news:OVudKziyDHA.540@tk2msftngp13.phx.gbl">news:OVudKziyDHA.540@t=
k2msftngp13.phx.gbl</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Does anyone know how I can include =
the users=20
parent container from the following script? The "ou" portion =
(in=20
BLACK) is where I was trying to gather that, but it doesn't=20
work.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 =
size=3D2><STRONG>strDNSDomain =3D=20
objRootDSE.Get("defaultNamingContext")<BR>strFilter =3D=20
"(&(objectCategory=3Dperson)(objectClass=3Duser))"<BR>strQuery =
=3D=20
"<LDAP://" & strDNSDomain & ">;" & strFilter =
_<BR> =20
& ";distinguishedName,cn,<FONT=20
=
color=3D#000000>ou</FONT>,userPrincipalName,sAMAccountName;subtree"</STRO=
NG></FONT></DIV>
<DIV><STRONG><FONT face=3DArial color=3D#ff0000=20
size=3D2></FONT></STRONG> </DIV>
<DIV><STRONG><FONT face=3DArial color=3D#000000=20
size=3D2></FONT></STRONG> </DIV>
<DIV><STRONG><FONT face=3DArial =
size=3D2></FONT></STRONG> </DIV>
<DIV><STRONG><FONT face=3DArial size=3D2>The script below returns =
exactly what=20
I'm looking for however, I can't figure out how to incorporate in =
into the=20
query. I'm trying to populate</FONT></STRONG></DIV>
<DIV><STRONG><FONT face=3DArial size=3D2>a spreadsheet with the =
information that=20
is returned from the "sUserOU" variable.</FONT></STRONG></DIV>
<DIV><STRONG><FONT face=3DArial =
size=3D2></FONT></STRONG> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>' Connect to the =
LDAP server's=20
root object<BR>Set oADsRootDSE =3D GetObject("</FONT><A=20
href=3D"ldap://RootDSE"><FONT face=3DArial color=3D#ff0000=20
size=3D2>LDAP://RootDSE</FONT></A><FONT face=3DArial color=3D#ff0000 =
size=3D2>")</FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>Set oADsSysInfo =3D =
CreateObject("ADSystemInfo")</FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>' Get distinguished =
name of the=20
current user<BR>sADsUser =3D oADsSysInfo.UserName<BR>WScript.Echo=20
"Distinguished name: " & sADsUser</FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>' Get user =
object<BR>sUserPath =3D=20
"LDAP://" & sADsUser<BR>Set oADsContainer =3D=20
GetObject(sUserPath)</FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>sUserOU =3D=20
oADsContainer.parent<BR>WScript.Echo "Users OU: " &=20
<STRONG>sUserOU</STRONG></FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>' Get full name of =
the current=20
user<BR>sUserNameFull =3D oADsContainer.cn<BR>WScript.Echo "Full =
name: " &=20
sUserNameFull</FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>Here is the format that the =
results are=20
returned.</STRONG></FONT></DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#