'This script should be set as a USER login script in an Active Directory GPO. It will populate
'the 'Description' field in the AD 'Users and Computers' console for both the Computer and
'the User objects with the username of whomever logged in, the name of the PC they logged
'into, the time they logged into it and which domain controller that they authenticated with.
On Error Resume Next
SetLocale("en-au")
Dim strDisplayMessage
Dim objSysInfo, objUser, objComputer
Set objSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
Set objDomain = GetObject("LDAP://rootDse")
objAuthDC = objDomain.Get("dnsHostName")
strDisplayMessage = objUser.CN & " last logged on to " & objComputer.CN & " - " & Now & " - " & objAuthDC & "."
objUser.Description = strDisplayMessage
objUser.SetInfo
objComputer.Description = strDisplayMessage
objComputer.SetInfo
WScript.Quit
|