将CSV格式化为
User Department
myname test1
yourname test1
有脚本:
$data = import-csv c:\ad.csv
$data |% {
set-qaduser $_.$User -department $_.department
}
导入工作正常,但我无法进行字段更改,不断收到错误:
Set-QADUser : Cannot validate argument on parameter 'Identity'. The argument is null or empty. Supply an argument that is not null or empty and then try the command again.
At line:3 char:12
任何人都能引导我朝着正确的方向前进吗?
答案 0 :(得分:0)
$_.$User
周围有一个额外的角色。它应该是$_.User
。
$data = import-csv c:\ad.csv;
$data |% {
Set-QADUser -Identity $_.User -Department $_.department;
}