понедельник, 19 декабря 2016 г.

Перенос пользователей из списка в указанный OU Active Directory

Скрипт на PowerShell. Запуск с повышением прав.

CSV файл создается в Excel. Одна колонка. Первая строка содержит name. Ниже логин пользователя без домена.

clear
# Import AD Module 
import-module ActiveDirectory 

# Import CSV  
$MoveList = Import-Csv -Path "C:\export\otherUser.csv" 
# Specify target OU.This is where users will be moved. 
$TargetOU =  "OU=otherUser,OU=LOCK-OBJ,OU=MAIN,DC=gladspir,DC=ru" 
# Import the data from CSV file and assign it to variable  
$Imported_csv = Import-Csv -Path "C:\export\otherUser.csv"  

$Imported_csv | ForEach-Object { 
     # Retrieve DN of User. 
     $UserDN  = (Get-ADUser -Identity $_.Name).distinguishedName 
     Write-Host " Moving Accounts ..... " 
     # Move user to target OU. 
     Move-ADObject  -Identity $UserDN  -TargetPath $TargetOU 
      
 } 
 Write-Host " Completed move "  
 $total = ($MoveList).count 
 Write-Host "  $total accounts have been moved succesfully..."

Комментариев нет:

Отправить комментарий

Failed to install module libnvdimmvmxnet3

The fix is this: in /etc/dracut.conf.d/*.conf > nvdimm-security.conf > vmware-tools.conf, edit the "add_drivers" line to ...