genesis Posted June 4, 2017 Posted June 4, 2017 I have migrated all of our users folders to a new server. From \\Server-A\StaffDocShare\UserName, To \\Server-B\StaffDocShare\Username When I go to the Users properties in the Active directory - Profile- Home Folder It Says Connect to “H” Drive To \\Server-A\ StaffDocShare \username Is there an easy way to change all the Users home drives pointing to Server-B \\File server-B\StaffDocShare\username The name of the share is StaffDocShare In the AD We have a main OU called: Staff - Admin -Teachers In the Admin OU there are 50 users and in Teachers OU there are 150 users. Manually editing the home drive path for each user is time consuming. Please suggest if there are ant tools or batch files to do this task. Thanks any help would be great
DJ-1701 Posted June 4, 2017 Posted June 4, 2017 Select all users in the OU, right click, select Properties, click on the Profile tab, select the home drive letter as H, type the new location in, but for the username part do %Username%. %Username% will fill in the correct username for each account. 2
Arthur Posted June 4, 2017 Posted June 4, 2017 This PowerShell script should do the trick. Change the bit in red to the relevant OU path. Get-ADUser -SearchBase '[color="#FF0000"]OU=Staff,OU=Users,DC=example,DC=net[/color]' -Properties * -LDAPFilter "(&(homeDirectory=\\Server-A\StaffDocShare\*))" -SearchScope Subtree | ForEach-Object { $NewHome = "{0}\{1}" -f '\\Server-B\StaffDocShare', $_.sAMAccountName Set-ADUser -Identity $_ -HomeDirectory $NewHome -HomeDrive H: -WhatIf } Remove the -WhatIf parameter on Set-ADUser once you are happy it does what you need (unless you have already done it using @DJ-1701's method of course). 1
Guest obsidianpillar Posted June 4, 2017 Posted June 4, 2017 ... also consider setting up DFS to make this process less "painful" next time...
ADMaster Posted June 4, 2017 Posted June 4, 2017 To prevent needing to do this in the future setup DFS. Overview of DFS Namespaces You don't need to have it replicate or have multiple targets, this will just give a single unchanging unc path for your shares. Then when you need to change the server they are hosted on, just change the target in DFS. The end users will never know the difference. 1
FN-GM Posted June 5, 2017 Posted June 5, 2017 I use DFS. It also doesn't break offline files on laptops when you move server. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now