- This topic has 2 replies, 2 voices, and was last updated 12 months ago by
July 7, 2019 at 1:49 pm #164563ParticipantTopics: 67Replies: 71Points: 526Rank: Major Contributor
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?
July 7, 2019 at 4:27 pm #164608ParticipantTopics: 67Replies: 71Points: 526Rank: Major Contributor
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'
July 7, 2019 at 5:55 pm #164617Senior ModeratorTopics: 9Replies: 1236Points: 4,443Rank: Community Hero
The documentation says, it requires a colon.
- The topic ‘Create H Drive within Active Directory’ is closed to new replies.