Hello everyone,

I am trying to deploy software to workstations depending on AD userID.
- when i ran this code with domain admin account credentials, it shows UserID of Domain Admin not my UserID(Currently logged in ID)
- When i run this code using my credentials, it shows my UserID

Should i use other code, or look in registry for currently logged in user and use that value to verify AD information.

Thanks for Help


$oADSysInfo = CreateObject("ADSystemInfo")
$strUser = $oADSysInfo.UserName
$oUser = GetObject("LDAP://" + $strUser)
$strsAMAccountName = $oUser.sAMAccountName
?$strsAMAccountName