Link to home
Start Free TrialLog in
Avatar of nordtorp
nordtorpFlag for Norway

asked on

08 Jul 10 09 - Powershell - TS Home Directory

Sirs,

I have a rare problem.

Background:
I have set the TSHomeDrive and TSHomeDirectory property of a user at a Windows Server 2008 through PowerShell (v2.0).
I use Quest ActiveRoles Management Shell cmdlets to make these changes. This is the command I run:

Set-QADUser $id -TsHomeDrive "H" -TsHomeDirectory $TSHome

Problem:
When I try to login to a TS with this user the home drive is not mapped.

Workaround:
Open the user AD object and set TSHomeDirectory to Local Path, then set it back to Connect. Log back in.

I am looking for a way to get this to work by just setting these settiings in PowerShell. The domain functional level is 2003, but the command ran from a 2008 AD controller (still 2003 functional level)

Please ask for more details relevant to this if you feel I left something out.
Avatar of Joseph Daly
Joseph Daly
Flag of United States of America image

I dont know if powershell is a must for this but I have done this is the past quite easily using admodify. This tool will let you select any of your users either by ou, name, ldap query,etc and then set any attribute youd like for them.

To enable the terminal services tab you need to run this tool from a server 2003 or higher computer.

Download here
http://admodify.codeplex.com/


1.jpg
Avatar of nordtorp

ASKER

xxdcmast,

Thank you for the response, but I would like to know why this happen.

Does 2003 and 2008 read the values differently? I have read the values through PowerShell, but it seems to be the exact thing.
ASKER CERTIFIED SOLUTION
Avatar of gtworek
gtworek
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
One additional info if you missed it: my script reads CSV file so the first line should contain "username" word and next lines should contain real user names in AD.
Thank you for the answer gtworek.

Please see my code below. I will show what I tried earlier on and what changes I made corresponding to your example.

AND IT WORKED :D

You will get full points for this, but the million dollar question is, why did it work?
Before:
    $quser = get-qaduser $user
    $TSHome = '\\server\private$\$user'

    $quser.TsHomeDrive = 'H:'
    $quser.TsHomeDirectory = $TShome 
    $quser.CommitChanges()

Now:
    $quser = (get-qaduser $user)    
    $TSHome = '\\server\private$\'

    $quser.TsHomeDrive = 'H:'
    $quser.TsHomeDirectory = $TShome+$user 
    $quser.CommitChanges()

Open in new window

I have no idea :)
And no possibility to check now. But I suggest you to test your old script step by step and look into your variables including Get-Members cmdlet.
Thank you for your answer, I have been trying a lot of things, and the solution were just in front of my nose.

Thanks again!