批量移动AD用户到指定OU

时间:2022-07-21 14:22:21
【文件属性】:

文件名称:批量移动AD用户到指定OU

文件大小:631B

文件格式:7Z

更新时间:2022-07-21 14:22:21

Active Directory

# Import AD Module import-module ActiveDirectory # Import CSV # Import the data from CSV file and assign it to variable $Imported = Import-Csv -Path "C:\tool\move-user.csv" $Imported | ForEach-Object { # Retrieve DN of User. $UserDN = (Get-ADUser -Identity $_.Username).distinguishedName $TargetOU = $_.TargetOU Write-Host " Moving Accounts ..... " # Move user to target OU. Move-ADObject -Identity $UserDN -TargetPath $TargetOU } Write-Host " Completed move " $total = ($Imported).count Write-Host $total "User Moved Successfully" 官方文档:https://gallery.technet.microsoft.com/scriptcenter/Move-Bulk-AD-user-from-One-1d4cf28c


【文件预览】:
Bulk user move
----Bulk user move _v1.0.ps1(602B)
----move-user.csv(93B)

网友评论