【问题标题】:Issue with active directory attribute import活动目录属性导入问题
【发布时间】:2014-05-29 01:36:26
【问题描述】:

我正在尝试从下面的脚本中批量更新用户的 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}}}

非常感谢任何帮助。

谢谢

【问题讨论】:

  • 这听起来像是 CSV 文件本身的问题。试着自己做,不要用管道输出。

标签: windows powershell csv attributes active-directory


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2012-02-06
    • 2010-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-18
    • 1970-01-01
    相关资源
    最近更新 更多