Advertisement
Corbin22

Update AD Description on Login and Logout.vbs

Mar 29th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Set this script to run on user logon/logoff.
  2. #This script will:
  3. #Update the Computer Description with which user last logged in/out.
  4. #Update the User Description with which computer they last logged into/out of.
  5.  
  6. Set objSysInfo = CreateObject("ADSystemInfo")
  7.  
  8. Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
  9. Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
  10.  
  11. strMessage = objUser.CN & " logged in at " & objComputer.CN & " " & Now & "."
  12.  
  13. 'objUser.Description = strMessage
  14. 'objUser.SetInfo
  15.  
  16. objComputer.Description = strMessage
  17. objComputer.SetInfo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement