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

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

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


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

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


Пробовал вот таким вот скриптом но не получаеться
Import-Module ActiveDirectory
#Import CSV
$csv = @()
$csv = Import-Csv -Path "sample.csv"

#Get Domain Base
$searchbase = Get-ADDomain | ForEach { $_.DistinguishedName }

#Loop through all items in the CSV
ForEach ($item In $csv)
{
#Check if the OU exists
$check = [ADSI]::Exists("LDAP://$($searchbase)")

If ($check -eq $True)
{
Try
{
#Check if the User already exists
$Name=$item.Name
$user=Get-ADUser -Filter {Name -eq $Name}
$user.telephoneNumber=$item.telephoneNumber
$user.mail=$item.mail
Set-ADUser -Instance $user
Write-Host "User $($user.Name) changed!"

}
Catch
{
Write-Host "User $($item.Name) is not existed!"
}
}
Else
{
Write-Host "Target OU can't be found! Operation skipped!"
}

Отправлено: 16:03, 05-03-2014 | #3