Can anyone help me out with a few Active Directory field names, how to
find them, or what they are? I'm struggeling to find the the names
for;
- the user profile logon script
- the terminal services profile path
- I would also like to return the list of security permissions, and
the list of groups each user is a member of, but I have a feeling,
being a list they will be more complicated to return.
So far what I have works fine for the easy bits ( account name, email
address, NT profile path). I am building a database of User data for
our ID dept, and this part grabs info from AD, I will run this
regularly to update me DB. Here is some of what I have so far,
hopefully that will help you see what I'm doing.


Set oFSO = CreateObject("Scripting.FileSystemObject")

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

' gets the DNS domain.
Set objRootDSE = GetObject("LDAP://RootDSE")
strConfig = objRootDSE.Get("configurationNamingContext")
strDNSDomain = objRootDSE.Get("defaultNamingContext")

classFilter = "(&(objectCategory=person)(objectClass=user))"
strType = "user"
strAttributes = "sAMAccountName,objectClass,ADsPath,lastLogon,distinguishedName,userAccountControl"
sQuery = "<LDAP://" & strDNSDomain & ">;" & classFilter & ";" &
strAttributes & ";subtree"
oCommand.CommandText = sQuery
oCommand.Properties("Page Size") = 1000
oCommand.Properties("Timeout") = 60
oCommand.Properties("Cache Results") = False

Set oResults = oCommand.Execute

' Loop through oResults(the AD objects) and print out the results
Do Until oResults.EOF
Set oGroup = GetObject("LDAP://" & strDNSDomain)
Set oUser = GetObject(oResults.Fields("ADsPath"))

' Output results
Set file = oFSO.OpenTextFile(sLogFile, 8, True)

file.Write("SAM account name: " & oUser.SAMAccountName & "; ")
file.Write("E-mail address: " & oUser.Mail & "; ")
file.Writeline("User profile path: " & oUser.ProfilePath & "; ")


oResults.MoveNext
file.Close
Loop

oConnection.Close


At the moment all I think I'm after is the field that I would append
to oUser, eg something like oUser.LogonScript to return the logon
script, however it's not 'LogonScript' and I have tried everything I
can think of. I know there fields exist as I have filled them out in
AD in some cases myself.
Any help would be greatly appreciated.
Thanks

Re: AD field names by Olivier

Olivier
Wed Jul 21 03:13:05 CDT 2004

> Can anyone help me out with a few Active Directory field names, how to
> find them, or what they are? I'm struggeling to find the the names

Check this site: http://www.rlmueller.net/UserAttributes.htm

For terminal server:

'-----------------------------------------------------------------------
' ONLY WORKS ON Windows 2003!!!!!
'-----------------------------------------------------------------------
objUser.AllowLogon = 1 ' Disabled = 0, Enabled = 1
objUser.TerminalServicesProfilePath = StrProfile & "\tse"
objUser.EnableRemoteControl = 3 ' EnableRemoteControl Values:
' Disable = 0
' EnableInputNotify = 1
' EnableInputNoNotify = 2
' EnableNoInputNotify = 3
' EnableNoInputNoNotify = 4
objUser.BrokenConnectionAction = 1 ' Disconnect = 0, End Session = 1
objUser.MaxConnectionTime = 60 ' Time in minutes
objUser.MaxDisconnectionTime = 1 ' Time in minutes
objUser.MaxIdleTime = 10 ' Time in minutes
objUser.ReconnectionAction = 1 ' Any Client = 0, Originating client =
1
objUser.SetInfo

gr.

Olivier



Re: AD field names by Torgeir

Torgeir
Wed Jul 21 03:55:28 CDT 2004

Chris wrote:

> Can anyone help me out with a few Active Directory field names, how to
> find them, or what they are? I'm struggeling to find the the names
> for;
> - the user profile logon script
> - the terminal services profile path
> (snip)
Hi

Unless you run your script from a Windows 2003 Server, you will need
to use 3rd party components to be able to obtain the terminal
services profile path.

A 3rd party free DLL that can do this is EOLWTSCOM.dll:

http://groups.google.com/groups?selm=3E4A9464.DD8B201B%40hydro.com


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx