Petit script pour déplacer les postes dans les bonnes UO suite à une migration
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import-module ActiveDirectory $MoveList = Import-Csv -Path "d:\Temp\MauvaiseOU.csv" -Delimiter "," ForEach ($item in $MoveList){ # mon CSV contient 2 colonnes "Device Name" et "PAYS" $Computer = $item.'Device Name' $pays = $item.PAYS $Type = $Computer.SubString(0,3) $TargetOU = "DC=leblogosd,DC=lan" If (($type -eq "LFR") -and ($pays -eq "BE")) { $TargetOU = 'OU=Portable,DC=leblogosd,DC=lan' } write-host $Computer Get-ADComputer $Computer | Move-ADObject -TargetPath $TargetOU } |
Cet article n'a pas été revu depuis la publication.
Cet article a été créé par david le 24 juin 2019.
Laisser un commentaire