Create H Drive within Active Directory

I have an Active Directory oddity from the results of a script that I have composed and can’t figure out why this situation is occurring.

I have a script that will create an Active Directory account and the associated settings along with it. One of the settings is the H: drive (within AD interface on the Profile Tab under the Home Folder section) and the home directory path.

I accomplish this by executing the following command.

Set-ADUser $user.SamAccountName -HomeDrive H -HomeDirectory '\\cfs04\tptest-users$\bctest'

After I run my script, I go to the AD server and look at the bctest user and confirm within the AD interface, on the profile tab, there is a Home Folder with the ‘H’ drive selected and the correct Path.

With that recently created account, log into a terminal server to verify the H drive is there. A home path has been mapped but it has not mapped with an H drive but with a Z drive.

I go back to Active directory and verify that it does indeed show that ‘H’ drive is the selected drive. I then log out of my ts session and then from within Active Directory, change the H: drive to another drive, change it back to the H: drive and apply. I log into the TS session and I see that the drive has correctly mapped with an H and not a Z.

So the command above is not declaring an H drive at all.

 

Does anyone see an error in my statement above?

 

 

 

I withdraw my query. Representing the Drive letter requires it is in quotes with a colon. I have seen examples where it does not include the quote, but apparently it is required.

 

Set-ADUser -Server w2k8-dc2 -Identity $user.SamAccountName -HomeDrive "H:" -HomeDirectory '\\cfs04\tptest-users$\bctest'

The documentation says, it requires a colon.

https://docs.microsoft.com/en-us/powershell/module/addsadministration/set-aduser?view=win10-ps#optional-parameters