Hi folks!
I need to change many users' home directories in AD and I wanted to start by testing the powershell command on one user. I'm TRYING to set the homedirectory to \\server\path\username, but it is instead being set as just \\server\path\.
In Active Directory Module for Windows Powershell, as Administrator, I'm using the command:
set-aduser -identity testuser -HomeDrive "P:" -HomeDirectory "\\server\path\$($_.SameAccountName)"
I expect that to set the homedirectory to \\server\path\testuser but the homedirectory is instead set to \\server\path\. But I have found many people saying this exact command is the one that worked for them. I can't get it, or any variation I have tried, to work for me.
I can manually set the folder using set-aduser -identity testuser -HomeDrive "P:" -HomeDirectory "\\server\path\testuser" and that works...