I have script that currently queries a specific OU for the computer name, Operating System, Owner, and the date it was added.
I also need to find out the the user ID of the last person to login. I just haven't been able to find a listing for the attribute. (Assuming the method I've implemented will work in this case.)
If it's not possible to get the last logged in user, a list of user profiles that exist on the computer might work as well. Subroutine listed below.
Thanks in advance!!
'Set oneLevelOU= GetObject("LDAP://" & strObjectDN)
Set objOU = GetObject("LDAP://" & strObjectDN)
objOU.Filter = Array("Computer")
Set objUser = GetObject("LDAP://" & strObjectDN)
Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each objComputer In objOU
Set objNtSecurityDescriptor = objComputer.Get("ntSecurityDescriptor")
Excel.Cells(counter,1).Value = objComputer.CN
Excel.Cells(counter,2).Value = objComputer.OperatingSystem
Excel.Cells(counter,3).Value = objNtSecurityDescriptor.owner
Excel.Cells(counter,4).Value = objComputer.whenCreated
'Excel.Cells(counter,5).Value = objComputer.LastUserToLogin **need this attribute **
counter =counter +1