Skip to content

Instantly share code, notes, and snippets.

@gjyoung1974
Created October 17, 2019 00:17
Show Gist options
  • Save gjyoung1974/e04753c70cbf4715d55bd5900dfa4a6f to your computer and use it in GitHub Desktop.
Save gjyoung1974/e04753c70cbf4715d55bd5900dfa4a6f to your computer and use it in GitHub Desktop.
ADMT Active Directory Migrate Users
$SearchBase='OU=Users,OU=SomeOU,DC=ad,DC=SomeDomain'
$arr = Get-ADUser -Server "ad.SomeDomain" -SearchBase $SearchBase -Filter *
ForEach ($item in $arr) {
# Prepare the command line
$command = @'
cmd.exe /C C:\Windows\ADMT\admt.exe USER /n $item.SamAccountName.ToString() /o C:\users\SomeUser\options.ini
'@
# store the object:
Invoke-Expression -Command:$command
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment