There is an easier way to get this data. Please see the code below I stole copied ripped borrowed it from the board and it was initially posted by Kdyer or NtDoc if I'm correct. It gets a lot of AD attributes including the last login time.

 Code:
CLS
Break on
$username = @USERID
$userhome = TranslateName(3, "", 3, @LDomain + "\" + $username, 1)
$userinfo = GetObject("LDAP://" + $userhome[0])

? "General Info"
? "------------"
? " "
? "First Name: " + $userinfo.givenName
? "Initials: " + $userinfo.initials
? "Last Name: " + $userinfo.sn
? "Full Name: " + $userinfo.FullName
? "Display Name: " + $userinfo.displayName
? "Account Name: " + $userinfo.sAMAccountName
? "Distinguished Name: " + $userinfo.distinguishedName
? "Description: " + $userinfo.Description
? "Office Location: " + $userinfo.physicalDeliveryOfficeName
? "Email: " + $userinfo.mail
? "Web Page: " + $userinfo.wwwHomePage
? "Street: " + $userinfo.streetAddress
? "Postal Code: " + $userinfo.postalCode
? "Post Office Box: " + $userinfo.postOfficeBox
? "City: " + $userinfo.l
? "State or Province: " + $userinfo.st
? "Country or Region: " + $userinfo.co
? "Home Phone: " + $userinfo.homePhone
? "Pager: " + $userinfo.pager
? "Mobile Phone: " + $userinfo.mobile
? "Telephone Number: " + $userinfo.telephoneNumber 
? "Fax Number: " + $userinfo.facsimileTelephoneNumber
? "Notes: " + $userinfo.info
? "Title: " + $userinfo.title
? "Department: " + $userinfo.department
? "Company Name: " + $userinfo.company
? "Principal Name: " + $userinfo.userPrincipalName
? " "
? "Profile Info"
? "------------"
? " "
? "Profile Path: " + $userinfo.profilePath
? "Script Path: " + $userinfo.scriptPath
? "Home Directory: " + $userinfo.homeDirectory
? "Home Drive: " + $userinfo.homeDrive
? "Terminal Services Profile Path: " + $userinfo.TerminalServicesProfilePath
? "Terminal Services Local Path: " + $userinfo.TerminalServicesHomeDirectory
? "Terminal Services Home Drive: " + $userinfo.TerminalServicesHomeDrive
? "Terminal Services Allowed: " + $userinfo.AllowLogon
? " "
? "Account Info"
? "------------"
? " "
? "User Account Control: " + $userinfo.userAccountControl
? "Account Disabled: " + $userinfo.AccountDisabled
? "Account Locked: " + $userinfo.IsAccountLocked
? "Account Created: " + $userinfo.whenCreated
? "Account Last Modified: " + $userinfo.whenChanged
? "Account Expires: " + $userinfo.AccountExpirationDate
? "Last Login: " + $userinfo.LastLogin
? "Last Failed Login: " + $userinfo.LastFailedLogin
? "Logon Count: " + $userinfo.logonCount
? "Bad Login Count: " + $userinfo.BadLoginCount
? "Password Last Changed: " + $userinfo.PasswordLastChanged

? 'Press a key...'
Get $

; TranslateName function authored by Howard A. Bullock
Function TranslateName($InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType)
	Dim $InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType
	Dim $NameTranslate, $ReturnName, $Error, $ErrorText
	$Error = 0
	$ErrorText = ""
	$ReturnName = ""
	$NameTranslate = CreateObject("NameTranslate")
	$Error = @error
	$ErrorText = @serror
	If $Error = 0
		$NameTranslate.Init($InitType, $BindName)
		$Error = @error
		$ErrorText = @serror
		If $Error = 0
			$NameTranslate.Set($LookupNameType, $LookupName)
			$Error = @error
			$ErrorText = @serror
			If $Error = 0
				$ReturnName = $NameTranslate.Get($ReturnNameType)
				$Error = @error
				$ErrorText = @serror
			EndIf
		EndIf
	EndIf
	$TranslateName = $ReturnName, $Error, $ErrorText
EndFunction
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.