我需要在此或Exchange代码中添加来自.csv文件的信息
我有此链接,该链接将广告用户从OU通过来自.csv文件的信息更改。
在我的IT结构中,信息regiao
和diretoria
是必须包含在广告用户部门领域中的信息。
如何获取信息并在变量中重复使用?
`Department = $região + ", " + $Diretoria`
Import-Csv -Path C:\Users\leonan.martins\Desktop\teste2.csv | ForEach-Object {
$target = [string]::Format(
"OU={0},OU={1},OU={2},DC=lab,DC=suporti,DC=local",
$_.Regiao, $_.Diretoria, $_.Area
)
Get-ADUser $_.User | Move-ADObject -TargetPath $target
Write-Host "OUs dos usuários ALTERADAS!"
}
I have this link that changes the AD user from OU through information coming from a .csv file.
In my IT structure, the information regiao
and diretoria
are the information that must also be contained in the Department field of the ad user.
How do I get the information and reuse it in the variables?
`Department = $região + ", " + $Diretoria`
Import-Csv -Path C:\Users\leonan.martins\Desktop\teste2.csv | ForEach-Object {
$target = [string]::Format(
"OU={0},OU={1},OU={2},DC=lab,DC=suporti,DC=local",
$_.Regiao, $_.Diretoria, $_.Area
)
Get-ADUser $_.User | Move-ADObject -TargetPath $target
Write-Host "OUs dos usuários ALTERADAS!"
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我正确理解,您正在想移动广告对象,但还设置它是
decr验反之亦然。您可以使用
-passTrhu
返回正在使用的对象,该对象允许您在流管线中完成两个操作:If I understand correctly, you're looking to move the AD Object but also, set it's
Department
attribute, in which case you could either first set the user's attribute and then move it to the target Organizational Unit or vice-versa. You can use-PassThru
to return the object you are working with which allows you to complete both operations in a streamed pipeline: