I am wanting to move my users to the correct OU's based on last name. I currently have this script and I'm running into an issue. When I run GetEnumerator for the last name it does all the letters. I'm just wanting the first letter.
Function MoveOUCurrent {
$UserAttributes=BuildUserTable $UpdateUserAttributesArray
Get-ADUser $UserADAccount
$LastName = $User.SN
$Lasts = $LastName.GetEnumerator()
foreach ($Last in $Lasts) {
if ($Last -eq 'A') {Move-ADObject $UserADAccount -targetpath 'OU=A-F,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'B') {Move-ADObject $UserADAccount -targetpath 'OU=A-F,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'C') {Move-ADObject $UserADAccount -targetpath 'OU=A-F,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'D') {Move-ADObject $UserADAccount -targetpath 'OU=A-F,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'E') {Move-ADObject $UserADAccount -targetpath 'OU=A-F,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'F') {Move-ADObject $UserADAccount -targetpath 'OU=G-L,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'G') {Move-ADObject $UserADAccount -targetpath 'OU=G-L,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'H') {Move-ADObject $UserADAccount -targetpath 'OU=G-L,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'I') {Move-ADObject $UserADAccount -targetpath 'OU=G-L,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'J') {Move-ADObject $UserADAccount -targetpath 'OU=G-L,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'K') {Move-ADObject $UserADAccount -targetpath 'OU=G-L,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'L') {Move-ADObject $UserADAccount -targetpath 'OU=G-L,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'M') {Move-ADObject $UserADAccount -targetpath 'OU=M-R,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'N') {Move-ADObject $UserADAccount -targetpath 'OU=M-R,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'O') {Move-ADObject $UserADAccount -targetpath 'OU=M-R,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'P') {Move-ADObject $UserADAccount -targetpath 'OU=M-R,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'Q') {Move-ADObject $UserADAccount -targetpath 'OU=M-R,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'R') {Move-ADObject $UserADAccount -targetpath 'OU=M-R,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'S') {Move-ADObject $UserADAccount -targetpath 'OU=S-Z,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'T') {Move-ADObject $UserADAccount -targetpath 'OU=S-Z,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'U') {Move-ADObject $UserADAccount -targetpath 'OU=S-Z,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'V') {Move-ADObject $UserADAccount -targetpath 'OU=S-Z,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'W') {Move-ADObject $UserADAccount -targetpath 'OU=S-Z,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'X') {Move-ADObject $UserADAccount -targetpath 'OU=S-Z,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'Y') {Move-ADObject $UserADAccount -targetpath 'OU=S-Z,OU=Current,OU=Students,DC=domain,DC=EDU'}
elseif ($Last -eq 'Z') {Move-ADObject $UserADAccount -targetpath 'OU=S-Z,OU=Current,OU=Students,DC=domain,DC=EDU'}
}
}