Joseph Moody
asked on
Write Last Logged On User to The Managed By Field in Active Directory
I am looking for a script that will write the last logged on user to the Manged by field in Active Directory for my computers. I would like to run it as both a logoff and shutdown script. My goal is to be able to search active directory for the username and see the last computer they logged onto.
Thank you for your help!
Thank you for your help!
ASKER
You are on the ball today!
I tried that script before and it works great but I would rather the service tag be placed in the description. I attached an image where I think it would make the most sense to go. Do you know of a better place?
Untitled.jpg
I tried that script before and it works great but I would rather the service tag be placed in the description. I attached an image where I think it would make the most sense to go. Do you know of a better place?
Untitled.jpg
Another way to achieve this without writing attributes is just to make a logon/logoff script that output the info you like to a log file located on a share.
http://support.microsoft.com/kb/556015
SG
http://support.microsoft.com/kb/556015
SG
That is actually the Manager field and it has to contain the distinguished name of the user. Give me a bit to modify the scirpt
ASKER
I've looked at outputting it to a share as well. My goal is to get all of the common information that was spread across many sources into active directory so that it is fully searchable and interconnected. For example, if a user calls me and says that their desktop is saying memory bad. I can look up the computer the user last logged onto and grab the service tag all from active directory.
ASKER
Thanks Pber! You are awesome!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That works but could it be set up so that the owner just reads their name instead of the entire path of their user?
The ManagedBy field is defined as a Distinguished Name field. You can't just put plain text in there. That is how it displays and it can't be changed.
ASKER
Thought that would be the answer. It works for me though!
ASKER
Thanks again!
Sorry about the display format, but glad to help.
ASKER
Nothing that you can do about it and it works perfectly!
Have you seen this solution here: http://blogs.technet.com/heyscriptingguy/archive/2005/04/29/how-can-i-change-the-user-and-computer-account-description-attributes-each-time-a-user-logs-on.aspx
It writes the logon info to the description field, but it could be modified to output to a different field.