使用csv文件更新AD属性 [英] Update AD attribute using csv file

查看:87
本文介绍了使用csv文件更新AD属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我想使用csv文件更新AD中的多个用户详细信息。 所有用户名都列在'name'下的文件中,用于更新的列称为'type'。


我需要为每个用户更新extensionattribute1并尝试以下操作:

 

Import-CSV C:\ Temp\ITTest.csv |
ForEach-Object {Get-ADUser -Filter" Name -eq`" $($ _.Name)`"" -Properties extensionAttribute1 | Set-ADUser -add @ {" extensionAttribute1" =" $($ _。类型)"}

我收到的错误是"为只能有一个属性的属性指定了多个值价值"


任何人都知道实现这一目标的方法吗?谢谢

解决方案


使用-Replace而不是-Add。


Hi,

I would like to update multiple user details in AD using a csv file.  All user names are listed in the file under 'name' and the column to use for updating is called 'type'.

I need to update the extensionattribute1 for each user and have tried the following:

Import-CSV C:\Temp\ITTest.csv | ForEach-Object {Get-ADUser -Filter "Name -eq `"$($_.Name)`"" -Properties extensionAttribute1 | Set-ADUser -add @{"extensionAttribute1" = "$($_.Type)"}

I receive the error that "multiple values were specified for an attribute that can have only one value"

Anyone know of a way to achieve this? Thanks

解决方案

Hi,

Use -Replace instead of -Add.


这篇关于使用csv文件更新AD属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆