If you can place the NAME of the target OU into each file as the 1st line (and the samAccountNames comprising the remainder of the file), then you can do this all in one small script:
$files = "users1-100.txt","users101-200.txt","users201-300.txt"
$files |
ForEach-Object{
# get just the 1st line of the input file (the name of the target OU)
$targetouname = Get-Content $_ |
Select-Object -First 1
$oudn = (Get-ADOrganizationalUnit -Filter "Name -eq '$targetouname'").distinguishedName
if ($oudn.length -gt 0){
Get-Content $_ |
Select-Object -Skip 1 | # skip the name of the target OU and just get users
ForEach-Object{
$u = $_.Trim() # remove any leading/trailing whitespace
if ($u.length -gt 0){
Try{
Get-AdUser -Identity $u -ErrorAction STOP # verify the user exists
Move-ADObject -Identity $u -TargetPath $oudn -ErrorAction STOP # move to target OU
}
Catch{
Write-Host "User $u not found in AD or Move-ADObject failed: $_"
}
}
}
}
Else{
Write-Host "OrganizationalUnit $targetouname was not found"
}
}