I am setting up a Terminal Server 2008 which will be used by different client organisations, each with multiple individual user accounts. I would like each client organisation to have a drive mapped to \server\clients\
Their OU name is also their client name, so I would like to be able to find their current OU and then use it for the mapping command. The OUs are hierarchicals, so it is the bottom-most OU name I need.
Example
OU:
Dedicated Clients\AjaxCorp
Should get a drive mapped to
\\server1\shares\AjaxCorp
Any suggestions on how I can get the OU? I am sure it must be easy, I just haven't figured it out...
I did find information about how to do this with VB script, but as it is a whole new environment I thought it would be nice to use PowerShell instead.