【发布时间】:2020-09-29 11:49:37
【问题描述】:
我在 Active Directory 中有一个用户列表,我必须删除其中的描述和办公室字段。我如何通过 poweshell 进行操作?我试试这个,但不行。
我的代码路径没问题
Import-Module ActiveDirectory
$Users = Import-csv C:\Users\xxxx\Desktop\test.csv
foreach($User in $Users){
Set-ADUser $User.SamAccountName -Description $User.NewDescription
}
我的 csv
SamAccountName;NewDescription;EmailAddress
xxxxxxxxxx;xxxxxxxxxxx;xxxxxxxxxxxxx@libero.it
Powershell 答案
Set-ADUser : Cannot validate argument on parameter 'Identity'. The argument is null. Provide a valid value for the
argument, and then try running the command again.
At line:4 char:12
+ Set-ADUser $User.SamAccountName -Description $User.NewDescription
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-ADUser], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.SetADUs
er
我们将不胜感激
【问题讨论】:
标签: powershell active-directory field-description