+ Post New Thread
Results 1 to 8 of 8
Scripts Thread, I need to change the home dir for every user in AD in Coding and Web Development; Currently all my users home directories point to: \fs1\home$\<year student started>\<student username> and for staff: \fs1\home$\teacher\<staffname> Now i've recently setup ...
  1. #1
    mrbios's Avatar
    Join Date
    Jun 2007
    Location
    Stroud, Gloucestershire
    Posts
    2,611
    Thank Post
    374
    Thanked 270 Times in 222 Posts
    Rep Power
    103

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

    Currently all my users home directories point to:
    \\fs1\home$\<year student started>\<student username>
    and for staff:
    \\fs1\home$\teacher\<staffname>

    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$\<year student started>\<student username>

    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?

  2. #2
    vizubeat's Avatar
    Join Date
    Feb 2010
    Posts
    27
    Thank Post
    6
    Thanked 7 Times in 5 Posts
    Rep Power
    11
    Bulk AD Users

    might do the trick

  3. Thanks to vizubeat from:

    mrbios (11th June 2012)

  4. #3

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,309
    Thank Post
    901
    Thanked 1,797 Times in 1,548 Posts
    Blog Entries
    12
    Rep Power
    466
    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.

  5. Thanks to FN-GM from:

    mrbios (11th June 2012)

  6. #4
    mrbios's Avatar
    Join Date
    Jun 2007
    Location
    Stroud, Gloucestershire
    Posts
    2,611
    Thank Post
    374
    Thanked 270 Times in 222 Posts
    Rep Power
    103
    Quote Originally Posted by FN-GM View Post
    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

  7. #5

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,309
    Thank Post
    901
    Thanked 1,797 Times in 1,548 Posts
    Blog Entries
    12
    Rep Power
    466
    That is a strange way of doing it.....

  8. #6

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,806
    Thank Post
    880
    Thanked 684 Times in 453 Posts
    Rep Power
    505
    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\<year-started>\%username% (replacing Year XX with the OU in question)

  9. #7
    ascott2's Avatar
    Join Date
    Nov 2007
    Posts
    185
    Thank Post
    18
    Thanked 39 Times in 31 Posts
    Rep Power
    21
    Code:
    #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

  10. #8

    Join Date
    May 2011
    Location
    Poole
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    ldifde is great for this sort of thing. See Using LDIFDE to import and export directory objects to Active Directory
    Export all users along with their profile path to an ldf file
    Edit it in Word using a Find and Replace approach
    Save as a text file and import.



SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 13
    Last Post: 22nd April 2011, 04:50 PM
  2. Need To Move The Network Documents Folder (Every User Account)
    By pritchardavid in forum Windows Server 2000/2003
    Replies: 10
    Last Post: 11th May 2010, 07:33 PM
  3. How to change display font size for all users of certain laptops?
    By HPitkin in forum Network and Classroom Management
    Replies: 2
    Last Post: 1st December 2008, 03:52 PM
  4. Need to buy a Laser Printer for the staff room.
    By tosca925 in forum Hardware
    Replies: 25
    Last Post: 10th October 2006, 06:15 PM
  5. Replies: 12
    Last Post: 12th September 2005, 11:47 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •