At the college I work at we are removing the students H: drive and I believe I have the correct powershell script to do that.
set-aduser -filter * -searchbase "ou=ouName,dc=domain.dc=local) | Set-ADUser -HomeDirectory $null
This script should search the entire OU and change all HomeDirectory's to $null correct?
The second issue I have will homeDirectory settings is for the employees. We are moving to a new file server and the newest AD accounts have the homeDirectory mapped based on \\DFSNameSpace\%username%. The older AD accounts are mapped via direct path \\server\share\%username% or \\server\share\%sn%
I need a script that will just update the front part of the \\server\share but leave the %username% or %sn% alone. I have come up with this but I does not do want I want.
set-aduser -filter * -searchbase "ou=ouName,dc=domain.dc=local) -homedirectory \\DFSNameSpace\%username%.