In attempts to automate a few things, I've come across a stumbling block with an import script for AD.
A part of the script contains:
New-ADUser -Name $Name –GivenName $Person.givenName –Surname $Person.sn –DisplayName $Name –SamAccountName $Username -HomeDrive "H:" -HomeDirectory $HDrive
The issue here is the -HomeDirectory $HDrive.
The variable $HDrive="\data\Staff Homedrives\"
How can i add %username% to the end of the HomeDirectory path?