Post

Csv dosyası icindeki kullanıcıların belli bir OU altına taşınması

PS ISE:

# Import CSV
$MoveList = Import-Csv -Path "C:\scripts\uyeler.csv"
# Specify target OU.This is where users will be moved - kullanicilarin tasinacağı OU
$TargetOU =  “OU=uyeler,DC=guler,DC=com”
# Import the data from CSV file and assign it to variable - ilgili .csv dosyası
$Imported_csv = Import-Csv -Path "C:\scripts\uyeler.csv"

$Imported_csv | ForEach-Object {
# Retrieve DN of User.
$UserDN  = (Get-ADUser -Identity $_.SAM).distinguishedName
Write-Host ” Moving Accounts ….. ”
# Move user to target OU. uyeler tasiniyor
Move-ADObject  -Identity $UserDN  -TargetPath $TargetOU
}
Write-Host ” Completed move ”
$total = ($MoveList).count
$total
Write-Host “Accounts have been moved succesfully… - tasima islemi tamamlandi..”

Best Regards.

This post is licensed under CC BY 4.0 by the author.