Script to move folders (will need tweaking with relevant details)
First grab the details of all your users:
- change the ou= part to reflect your OU structure. I broke it down into staff and students to reduce the load and split the work but you should be able to do the lot at once.
dsquery user -limit 0 "ou=Students,ou=Users,ou=School,dc=domain,dc=local" | dsget user -hmdir >students.txt
Copy and paste the contents of that text file into Excel, tidy it up so you just have a long list of home directory paths. In the second column use =CONCATENATE() to construct the new path, e.g. =CONCATENATE(A2,"Documents/") and drag that down the whole list.
Title the first column oldhmdir and the second column newhmdir
Save that as a CSV somewhere onto a domain controller - C:\Scripts\students.csv for example - then open up a powershell on that domain controller. Copy and paste the following code into it:
The minage is set so it doesn't try and move the new folder (hopefully), other flags listed @ Robocopy
$inputFile = Import-CSV C:\Scripts\students.csv
foreach($line in $inputFile)
robocopy /move $line.oldhmdir $line.newhmdir /s /MINAGE:1
It may need some tweaking (I was copying from one location to another, not trying to move content down a level) but the gist of it should be right, anyway. Will save you trawling through hoards of folders. Test it by using a copy of the CSV with all but the top two or three lines deleted so it doesn't take too long to fail or mess too much up.
EDIT: @macdaddy - new directories can be created programatically (in PowerShell, at least) with
New-Item $UNC_PATH -type directory