Sub
strComputer = "asdcom1"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_ComputerSystem")
For Each objItem in colItems
arrName = Split(objItem.UserName, "\")
Next
strUsername = arrName(1) 'strObjUser
strDomainName = arrName(0) 'strObjDomain
strCompName = UCase(strComputer)
Set objLDAPUser = GetObject("LDAP://" & GetUserDN(strUsername,strDomainName)) 'Get LDAP details of logged-on user to extract attributes...
Function GetUserDN(BYVAL UN, BYVAL DN) '...via this function to quickly get domain details of logged-on user from AD
Set objTrans = CreateObject("NameTranslate")
objTrans.init 1, DN
objTrans.set 3, DN & "\" & UN
strUserDN = objTrans.Get(1)
GetUserDN = strUserDN
End Function
End Sub