![]() $users = Get-ADUser -Filter * -SearchBase "OU=$deptnamesource,OU=users,OU=$rootOUsource,$domain" $deptnametarget = read-host "What is the TARGET department name?" $divnametarget = read-host "What is the TARGET division name?" Get-ADUser -Filter * -SearchBase "OU=$deptnamesource,OU=users,OU=$rootOUsource,$domain" Write-host "Retrieving user objects." -ForegroundColor Magenta $deptnamesource = read-host "What is the SOURCE department name?" $rootOUsource = read-host "What is the SOURCE root OU name?" $global:path = "OU=users,OU=IT,"dc=contoso,dc=com" Write-host "This script will move objects from one OU to another and set AD Home folder path." -ForegroundColor Magenta #This script will move objects from one OU to another and set AD Home folder path. I have tried a number of ways to get this to work (variables, $_.SamAccountName, etc), but so far, no luck. If I add "%username%" to the end of the path, the AD path will look like this - \\server\share\%username% (the user's name appears as "%username%", not Home folder path in AD, but %username% does not seem to be an option with Powershell. Normally, we would do this on an individual basis by just putting \\server\share\%username% in the The users' Home folders are named after their logon names. So far, I can get the script to change the path/drive letter correctly,īut I cannot get it to add the user's logon name to the end of the path (\\server\share\username). Now I am trying to bulk change those users' Home Folder paths (and drive letter). I have created a script which will bulk move all user objects in one OU to another OU. I have done a lot of searching on this, and still cannot find the answer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |