活动目录属性导入问题

时间:2014-05-29 01:36:26

标签: windows powershell csv attributes active-directory

我尝试从下面的脚本批量更新用户AD属性,但我不断收到以下错误:

Import-Csv : Cannot process argument because the value of argument "name" is invalid. Change the value of the "name" argument and run the operation again.
At line:1 char:11

从这个脚本:

Import-Csv c:\update.csv | ForEach-Object { Set-QADUser -Identity $_.sAMAccountName -ObjectAttributes @{department={$_.department} ;
company={$_.company} ;
physicalDeliveryOfficeName={$_.physicalDeliveryOfficeName} ;
telephoneNumber={$_.telephoneNumber} ;
wWWHomePage={$_.wWWHomePage} ;homePhone={$_.homePhone};
title={$_.title}}}

非常感谢任何帮助。

由于

1 个答案:

答案 0 :(得分:0)

错误来自CSV文件中的尾随空白列。 Import-Csv使用CSV中的第一行作为列的名称(除非您另行指定),当您有空白列(或至少多个空白列)时,它会导致此错误,因为它没有有效的名称