![](/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.