Author Posts

January 28, 2014 at 5:12 am

I need to move a buttload of home directories which I have covered with the following command.

Get-Content c:\scripts\test.txt | Foreach-Object {set-aduser $_ -HomeDirectory "\\ourserver\homedir\$_"}

But that only covers the home directory. How can I change the Terminal Services Home Folder?
Also known as the Remote Desktop Services Home Folder:
Screenshot of the attribute I need to change.

I checked the attribute editor and found nothing. I checked set-aduser and get-aduser's get-help list and didnt find anything.
How can I edit this attribute from Powershell?

January 28, 2014 at 5:30 am

Hi,

i did this with ADSI

$ou = [adsi]"$($OU)"
$user = $ou.psbase.get_children().find($DN)

$user.psbase.invokeSet("allowLogon",1)
$user.psbase.invokeSet("TerminalServicesHomeDirectory","$($HomeDirPathValue)")
$user.psbase.invokeSet("TerminalServicesProfilePath","$($ProfileDirPathValue)")
$user.psbase.invokeSet("TerminalServicesHomeDrive",$HomeDriveValue)
$user.setinfo()

January 28, 2014 at 11:45 pm

Hey Selko,

Oh that's pretty cool. Haven't heard of that before.

Just wondering how this finds the correct OU? Doesnt it just .. search for itself?