So, this one is quick and was primarily meant to be a quick example when presenting on the Quest AD cmdlets. The practical piece is to deal with something we experience when working remotely. Typical scenario, user logs in locally to their laptop and then connect to the corporate network via VPN. The home drive is not mapped because when the desktop state is loaded the VPN connection has not yet been made. So the script showed how to add a little function to their powershell profile so they could simply run the function to make their connection.
The script simply determines the current user name ($env:USERNAME), then reads the configured values for the corresponding Active directory object for the drive letter (Get-QADUser $env:USERNAME).HomeDrive and then the path (Get-QADUser $env:USERNAME).HomeDirectory , combining those two values to perform the drive mapping.