Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Аватара для serraxer

Новый участник


Сообщения: 29
Благодарности: 0

Профиль | Отправить PM | Цитировать


Прошу прощения а это как? Я пытаюсь получить список должностей (title).

Брал за основу рабочий скрипт который позволяет менять атрибуты из списка просто указав атрибут который надо поменять.
Скрытый текст
#Created by Brad Held
#This script changes attributes in Active Directory, while I have tested this in my environment
#I can not and will not take responsibility for anything that happens when running this script in your environment

#Get the Attribute from the user
$attribute = Read-Host "What is the attribute you want to modify?"

#Where to save the original values we are about to change
$out = "C:\Scripts\UpdateAttrib\Original.csv"

#Load the data - First row in the csv should be 0,1
$list = Import-CSV C:\Scripts\UpdateAttrib\Users.csv

#Loop through the data and get the user on the row
FOREACH ($Account in $list){
#Find the AD User Object
$User = Get-ADUser -identity $Account.0 -Properties Name,SamaccountName,$attribute

#Save the users current information to file
$User | FT Samaccountname,$attribute | Out-File $out -Append

#Modify the current user based on the information from csv
$User.$attribute = $Account.1

#Save that information back to the user account
Set-ADUser -Instance $User
}


В нем выборка идет как я понял по -identity который потом сравнивается с csv, запрос Get-ADUser -identity $Account.0
Я поменял -identity на -Filter и полагал что теперь начнется сравнение с csv в котором все прописано. Кстати если я пишу конкретный title то все заменяется.

Отправлено: 15:47, 07-06-2017 | #4