Is there a script that can change the servername and the pathname in the home
folder path in AD? User accounts are located in a single OU. We
migrated to a new file server. The domain controllers are Windows
2008.
Old home folder path:
\\old-server\share\username
New home folder path:
\\new-server\share$\username
We followed the below procedure,
Import-Module ActiveDirectory
$oldServerName = "twenty"
$newServerName = "thirty"
[array]$AllUsers = Get-ADUser * -Properties HomeDirectory
foreach($user in $AllUsers){
if(($user.HomeDirectory.ToString()).contains($oldServerName)){
$homeDirectory = ($user.HomeDirectory.ToString()) -replace $oldServerName, $newServerName
Set-ADUser $user.DistinguishedName -HomeDirectory $homeDirectory
}
}
It is not working since we need to change both the servername and sharename. We DONT want to change the user name. Any help will be appriciated
give any solution without any software.