![](/img/trans.png)
[英]Get AD users’ manager and primary group that is associated with a user's manager
[英]Get an AD user's manager and input it into column of table
我有一個.csv
文件,其中包含名字和姓氏,以及接受過我們的安全意識培訓的員工的電子郵件地址。
我想獲取電子郵件地址列,並將其與AD中的電子郵件地址進行比較,然后從AD中獲取經理,並將其放入表格的適當列中。
這是我到目前為止的內容:
Import-Csv -Path "filename.csv" |
Select-Object "First Name",
"Last Name",
"Email",
@{n="Manager";e={(Get-ADUser $_.Manager).EmailAddress}},
"Module Status",
"Module Status Date" |
Select -f 30 |
Format-Table
謝謝!
@{n="Manager";e={
$self = Get-ADUser $_.Email -properties manager
$manager = Get-ADUser $self.manager -properties emailAddress
$manager.emailAddress
}
當然,您可以根據需要將其寫得更短。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.