Thursday, January 13, 2011

HOWTO: PowerShell to manage AD user TS settings

Tip: Install PowerGUI as well the the QuestActiveRoles Management Shell for Active Directory modules. This provides the cmdlets like QADUser which we will be using below.

Setting TS attributes

Example: Set-QADUser mbailinovski -TsHomeDirectory "\\server\users$\mbailinov" -TsHomeDrive "W:"

Getting TS attributes
Retrieving terminal services properties is easy. You just execute Get-QADUser and the objects retrieved will have the corresponding properties – for your convenience, all starting with Ts.

Get-QADUser "Mitch Bailinovski" | format-list Ts*

TsProfilePath : \\server\users$\mbailinovski
TsHomeDirectory : \\server\users$\mbailinovski
TsHomeDrive : W:
TsAllowLogon : True
TsRemoteControl : 0
TsMaxDisconnectionTime : 00:00:00
TsMaxConnectionTime : 00:00:00
TsMaxIdleTime : 00:00:00
TsReconnectionAction : 1
TsBrokenConnectionAction : 0
TsConnectClientDrives : True
TsConnectPrinterDrives : True
TsDefaultToMainPrinter : True
TsWorkDirectory :
TsInitialProgram :

Important: Terminal services properties are only available when AD cmdlets are run on Windows Server 2003 or 2008 or when the Windows 2003 Server Administration Tools are installed.


No comments: