获取AD域\名称首字母powershell的全名

时间:2015-06-12 08:24:41

标签: powershell active-directory

我有一些powershell脚本可以获取某些文件的所有者:

$CreationOwner =Get-Acl $path | Select-Object Owner

但现在我有AD名称,因此domain\ar无论如何现在将其转换为此人的姓名

1 个答案:

答案 0 :(得分:0)

您可以使用ADSI(Active Directory Service Interfaces)来检索域用户的全名:

([adsi]"WinNT://$domain/$user,user").fullname

在你的情况下:

$domainUser = (Get-Acl $path | select -expand Owner) -replace '\\', '/'
$fullUserName = ([adsi]"WinNT://$domainUser,user").fullname
相关问题