Jump to content

I need to change the home dir for every user in AD


Recommended Posts

Posted

Currently all my users home directories point to:

\\fs1\home$\\

and for staff:

\\fs1\home$\teacher\

 

Now i've recently setup our data in two locations using DFSR which means i now wish to point everything to:

\\domain.local\Store\home$\\

 

Obviously it's only the bit prior to home$ that needs to change, but can anyone suggest an easy way of doing this on a mass scale?

Posted

Select all the users. Right Click > Properties and populate the home area path with

 

\\domain.local\Store\home$\year11\%username%

 

the %username will automatically correct itself on each account.

  • Thanks 1
Posted
Select all the users. Right Click > Properties and populate the home area path with

 

\\domain.local\Store\home$\year11\%username%

 

the %username will automatically correct itself on each account.

 

That'll work for the vast majority of my folders, only problem is two or three are "messy"

 

When we add new years in they have their own year started folder and their own corrosponding AD folder, but an old tech prior to us did something different and had all the folders based on birth year, so year groups were split in half through AD folders.....a bizarre way to do it but we're slowly weeding it out year by year.

 

Will have a look at bulk AD for that bit and see if i can sort that :) thanks

Posted

I did something similar....

 

OU for each Year Group and

Select all users in that OU and mass change the home folders to \\server.domain\Home$\Students\\%username% (replacing Year XX with the OU in question)

Posted

#Set-HomeDirectory.ps1
param
(
[parameter(Mandatory = $true)]
[string]$yeargroup
)

Get-ADUser -SearchBase "OU=$yeargroup,OU=Users,DC=test,DC=local" | ForEach { Set-ADUser $_ -HomeDirectory ('\\fileserver\home\$yeargroup\' + $_.SamAccountName) }

 

I have not tested this powershell script but I think that should work. Then you could run it for each year group, if the years are in seperate OU's eg Set-HomeDirectory.ps1 -yeargroup 11

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...