"Lanwench [MVP - Exchange]"
< hoo.com> wrote in message
news:%...
> Domain: AD 2003 or 2008
> Clients: XP Pro or <ptui> Vista
>
> I support a lot of small businesses and am always looking for admin
> shortcuts. I try to use fairly generic workstation names, and I put the
> users' full names in the computer object's decscription field so I know
> who to connect to for remote support, etc.
>
> The problem is, of course, that users and computers over time will tend to
> move, retire, quit, whatnot. I was wondering if anyone knew a way to
> somehow populate the description field with the name of the user who has
> logged into it. It would be fine if this happened every day (as long as it
> wasn't a lengthy or disruptive process). I would want this to be the
> object's description field, not the computer's local description field, so
> I can see it all in ADUC.
>
> I figured I'd go ask some smart geeky people. Any ideas?
>
In general this is not recommended as it creates a lot of replication
traffic. The computer object is modified at every logon. AD is designed to
store information that changes infrequently. However, in a small network
(one site) this probably will not be disruptive. It could be done in a logon
script. I would code it to not revise the object unless the description is
to be changed. For example (not tested):
=========
Option Explicit
Dim objSysInfo, strUserDN, strComputerDN, objComputer, strDesc
' Retrieve DN of user and computer.
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.UserName
strComputerDN = objSysInfo.ComputerName
' Bind to the AD computer object.
Set objComputer = GetObject("LDAP://" & strComputerDN)
' Check computer description.
strDesc = objComputer.Description
If (strDesc <> strUserDN) Then
' Update computer description.
objComputer.description = strUserDN
objComputer.SetInfo
End If
=========
In the above I used the full Distinguished Name of the user. You could use
the NT name (the value of the sAMAccountName attribute), or the displayName
attribute (if it has a value).
Of course, this requires that all users have permissions to update the
description attribute of computers. I believe by default that authenticated
users have read but not write permissions. If you do this, I would recommend
granting authenticated users permissions to write the description attribute
only.
Finally, another option is a logon script that logs the user and computer
names to a shared log file. I have an example linked here:
http://www.rlmueller.net/Logon5.htm
You only need the logon script referenced on the page. When a user calls you
can copy the log file (so you don't interfere with users logging on), then
find the last logon entry for the user to determine the computer.
And another idea would be a shortcut on the desktop that runs a script that
displays information like the local computer name.
--
Richard Mueller
MVP Directory Services
Hilltop Lab -
http://www.rlmueller.net
--