【问题标题】:get displayname from samaccountname从 samaccountname 获取显示名称
【发布时间】:2015-04-29 08:44:38
【问题描述】:

我正在寻找一种从用户的samaccountame 获取displayname 的方法。

$username = Read-host 'Username'
$user = Get-ADUser -Filter {samaccountname -like $($name.DisplayName)$username}

我想将displayname 放入一个名为$user 的变量中

有什么建议吗?

【问题讨论】:

  • Get-ADUser $username | select -expand name

标签: powershell active-directory


【解决方案1】:
$username = Read-host 'Username'
$user = Get-ADUser -Filter "samaccountname -eq '$username'" |select name

【讨论】:

    猜你喜欢
    • 2019-10-22
    • 1970-01-01
    • 1970-01-01
    • 2020-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-04
    • 1970-01-01
    相关资源
    最近更新 更多