【发布时间】:2020-07-01 11:34:24
【问题描述】:
我使用以下 POWER SHELL 脚本,从“Manager”用户属性中提取(到 csv)经理姓名。
#This script, , Exports the Manager name of the employee`s in the TXT file.
# users.txt file - contains a simply list of user names ( samaccount-names )
Get-Content D:\powershell\permmisions\Users.txt | Foreach-Object {
Get-ADUser -Identity $_ -Properties Manager | Select-Object name, Manager | Export-Csv D:\Powershell\ADuserinformation\Export-Managers-of-specific-users.csv
-Append
}
我面临的挑战是导出 CSV 文件的时间, 列表“SKIPS”空白值字段,以防没有为用户设置管理器。 并且没有创建 ROWS ,其中缺少 MANAGER。
我想做的是输入字符(〜)的脚本,例如,其中值为空白。 这样,将在 CSV 文件中为空白 MANAGER 值创建一行
请帮忙, 提前谢谢大家。
【问题讨论】:
标签: powershell active-directory