Logon script to modifiy computer description to reflect username

15 pts.
Tags:
Login scripts
Scripting
User profiles
Windows XP
Hi, as the title suggests we're looking for a way to track whose logged onto what machine, and a simple script solution would be ideal, basically something to modify the computer description field to reflect the username or fullname of the logged on user. Thanks

Answer Wiki

Thanks. We'll let you know when a new response is added.

Have a look at my blog, I describe all the steps to accomplish this in detail:

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Dales
    I think you proberbly should add the username variable to the output text entry otherwise the each time a log is created it will overwrite and not append the previous version. something like > \\share\path\%username%.txt would do it
    710 pointsBadges:
    report
  • YuvalShavit
    Putting two greater than signs (">>" instead of just ">") tells cmd to append to the file instead of just replacing and overwriting it. That said, I'm not sure what sorts of file locking cmd uses; my guess is that it doesn't have any, which could potentially be an issue if many users will be logging on (and thus running the script) simultaneously.
    905 pointsBadges:
    report
  • Yasb
    thanks for your response, but im specifically looking to add the user name to the description field of the computer's name (this description appears when viewing the domain/work group). thanks guys.
    15 pointsBadges:
    report
  • Altsysrq
    Why not just do this in Active Directory? Create a vb script: Set objSysInfo = CreateObject("ADSystemInfo") Set objUser = GetObject("LDAP://" & objSysInfo.UserName) Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName) REM strMessage = objUser.CN & " logged on to " & objComputer.CN & " " & Now & "." strMessage = objComputer.CN & " " & Now & "." objUser.Description = strMessage objUser.SetInfo strMessage = objUser.CN & " " & Now & "." objComputer.Description = strMessage objComputer.SetInfo Make sure Active Directory users can edit this field: 1) Right-click the OU/container where computer accounts reside and choose "Delegate Permissions" (do NOT do it for the whole AD as this will allow editing description of any computer object including Domain Controllers) 2) Click "Next" and in the next dialog add "Domain Users" group 3) In the next dialog select "Create a custom task to delegate" 4) Select "only the following objects in the folder" and check "computer objects" in the listbox 5) Click Next. In the next dialog make sure only "Property specific" is checked under "Show these permissions" 6) Check "Write description" 7) Click Next and Finish http://blogs.technet.com/b/heyscriptingguy/archive/2005/04/29/how-can-i-change-the-user-and-computer-account-description-attributes-each-time-a-user-logs-on.aspx
    10 pointsBadges:
    report
  • Voodooclanboy
    Hi all, I would like to suggest you to use a VBscript that updates the AD Computer Description with Username and Serial Number: sn = GetSerialNumber UpdateDescription(sn) Function GetSerialNumber strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2") Set colBIOS = objWMIService.ExecQuery _ ("Select * from Win32_BIOS") For each objBIOS in colBIOS GetSerialNumber = objBIOS.SerialNumber Next End Function Sub UpdateDescription(strDescription) Set objSysInfo = CreateObject("ADSystemInfo") Set objUser = GetObject("LDAP://" & objSysInfo.UserName) Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName) objComputer.Description = objUser.CN & " " & strDescription objComputer.SetInfo End Sub ---------------------------------- Again I would suggest you to use GPO's instead of using such scripts. You can also try third party tools like LELM, to work better in your AD. Thank you Anil Lepide
    1,140 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following