Bonjour,

Je suis débutant en PowerShell, j'essaye plusieurs scripts pour déplacer des ordinateurs inactifs dans mon active directory, comme celui ci :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
################################################################# 
# This script will help to move bulk ad computer accounts into target OU 
# Written 08/08/15 Casey, Dedeal 
# Fell free to change use any part of this script 
# http://www.smtp25.blogspot.com/ 
################################################################# 
 
#Importing AD Module 
Write-Host " Importing AD Module..... " 
import-module ActiveDirectory 
Write-Host " Importing Move List..... " 
# Reading list of computers from csv and loading into variable 
$MoveList = Import-Csv -Path "C:\temp\PC_Move_List.csv" 
# defining Target Path 
$TargetOU = 'OU=Désactivé,DC=********'  
$countPC    = ($movelist).count 
Write-Host " Starting import computers ..." 
 
foreach ($Computer in $MoveList){     
    Write-Host " Moving Computer Accounts..."  
    Get-ADComputer $Computer.CN | Move-ADObject -TargetPath $TargetOU 
} 
 
Write-Host " Completed Move List " 
 
Write-Host " $countPC  Computers have been moved "
Mais à chaque fois la même erreur, même avec d'autres scripts fournis par microsoft.. :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
Importing AD Module..... 
 Importing Move List..... 
 Starting import computers ...
 Moving Computer Accounts...
Get-ADComputer : Impossible de valider l'argument sur le paramètre «*Identity*». L’argument a la valeur Null ou un élément de la collection d’arguments contient une valeur Null.
Au caractère Ligne:21 : 20
+     Get-ADComputer $Computer.CN | Move-ADObject -TargetPath $TargetOU
+                    ~~~~~~~~~~~~
    + CategoryInfo          : InvalidData : (:) [Get-ADComputer], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.GetADComputer
Si quelqu'un avait une solution..

En vous remerciant d'avance