从CSV将用户详细信息导入Active Directory

时间:2017-03-31 12:46:50

标签: powershell

我们正在转向公司范围的电子邮件签名,要求用户将其姓名,职务和电话号码等都放入Active Directory。我找到了blog post,用简单的术语解释了如何实现这一目标。

Import-Csv 'C:\psscripts\test user for import.csv' | Set-QADUser -Identity {$_.email}

但是,当我运行PowerShell脚本时,它不会导入这些列......但不会显示任何错误。

  • 电子邮件
  • 传真(我重新定位了人们的头衔,例如“BSc,CEng,MIET”)
  • ******中国
  • StateOrProvince(重新用于人们的分机)
  • MobilePhone

所有不导入的列都是带有数字或特殊字符的列,我不确定这是否与它有关?

这是我正在导入的测试项目(我在字符串周围使用和不使用引号尝试了它):

DisplayName,Title,Company,Fax,Email,PhoneNumber,StateOrProvince,MobilePhone
Alan johnson,Engineering Manager,The Best company,"BEng (Hons)","Test.user@Mycompany.co.uk","+44 (0) 121 222 1547","1071","+44 (0) 793 155 7984"

我已经运行了get-member命令,因此您可以看到powershell如何解释数据。 import-Csv'C:\ psscripts \ test user for import.csv'|得到构件

>    TypeName: System.Management.Automation.PSCustomObject
> 
> Name            MemberType   Definition
> ----            ----------   ---------- 
Equals          Method       bool Equals(System.Object obj) 
GetHashCode     Method       int
> GetHashCode() GetType         Method       type GetType() ToString    
> Method       string ToString() Company         NoteProperty
> System.String Company=The Best company DisplayName     NoteProperty
> System.String DisplayName=Alan johnson Email           NoteProperty
> System.String Email=Test.user@myCompany.co.uk Fax            
> NoteProperty System.String Fax=BEng (Hons) MobilePhone    
> NoteProperty System.String MobilePhone=+44 (0) 121 222 1547
> PhoneNumber     NoteProperty System.String PhoneNumber=+44 (0) 793 155
> 7984 StateOrProvince NoteProperty System.String StateOrProvince=1071
> Title           NoteProperty System.String Title=Engineering Manager

0 个答案:

没有答案
相关问题