Presentation is loading. Please wait.

Presentation is loading. Please wait.

Command-line control of Terminal Services Christa Anderson.

Similar presentations


Presentation on theme: "Command-line control of Terminal Services Christa Anderson."— Presentation transcript:

1 Command-line control of Terminal Services Christa Anderson

2 Today’s event will run one-hour long. Here are the expected times for each segment of the Webcast: :00 – :05: Moderator introduces the speaker and discusses the details of the Webcast. :05- :25: Speaker delivers a PowerPoint presentation on the Webcast topic. :25- :35: Moderator and speaker engage in a brief Q&A on the topic :35- :60: The speaker responds to questions submitted by the audience. You can submit questions to the speaker at any time during the event. Just click on the “Ask a Question” button in the lower left corner of your screen. Webcast Schedule

3 Technical FAQs Q: Why can’t I hear the audio part of the webcast? A: Try increasing the volume on your computer. Q: I just entered the webcast and do not see the slide that the speaker is referring to. What should I do? A: The slides are constantly be pushed to your screen. You’ll should refresh (hit F5) to view the latest slide. Q: What time zone do the webcasts take place? A: The TechTarget webcasts all occur on Eastern Daylight Saving Time (UTC/GMT - 4 hours). Q. I can’t view some of the detail on the slides. How do I enlarge the slides for a better view? A: Click the “Enlarge slide” link in the upper right corner of your presentation. This will open a new browser with a full view of the current slide. You can also visit the Broadcast Help page for more information or to test your browser compatibility. Click here: http://audience.broadcast.yahoo.com You can also visit the Broadcast Help page for more information or to test your browser compatibility. Click here: http://audience.broadcast.yahoo.com

4 Agenda  Why is command-line editing useful?  What tools are available for command- line editing?  Using TSCMD.EXE for simple configuration  Using WMI and VBScript for more advanced configuration

5 Why Command-Line Editing?  Editing settings from the GUI is time- consuming on more than a few servers  Command-line edits can be scripted and are therefore more consistent.  Command-line edits don’t need to be done either at the console or by using a TSCAL to connect to the terminal server to be edited

6 What Tools Are Available?  Command-line configuration tools in Terminal Services  TSCMD.EXE  The new WMI provider for Terminal Services

7 Using TSCMD  Command-line support for common Terminal Services settings, based on a WTS API  Requires Windows 2000 or later on client and server  Edit the settings on the server where the settings are stored (e.g., domain controller)  Basic TSCMD syntax: tscmd [New Value]

8 Using TSCMD.EXE  Works across the network  Point it to the terminal server and user account you need to configure  Returns net error messages, so if you get an error run net help to troubleshoot  Settings take place immediately for the next user session—no need to reboot.  To make TSCMD.EXE report existing settings, run the command with no new value

9 TSCMD.EXE Settings InitialProgram WorkingDirectory InheritInitialProgram AllowLogonTerminalServer TimeoutConnection TimeoutDisconnect TimeoutIdle DeviceClientDrives DeviceClientPrinters DeviceClientDefaultPrinter BrokenTimeoutSettings ReconnectSettings ModemCallbackSettings ModemCallbackPhoneNumber ShadowingSettings TerminalServerProfilePath TerminalServerHomeDir TerminalServerHomeDirDrive

10 Disabling User Access tscmd sandworm scott allowlogonterminalserver 0

11 Editing Remote Control Settings tscmd sandworm scott shadowingsettings 1

12 Configuring Printer Settings tscmd sandworm scott deviceclientprinters 1 tscmd sandworm scott deviceclientdefaultprinter 1

13 Configuring Timeouts and Reconnects tscmd sandworm scott timeoutconnection 100 tscmd sandworm scott timeoutdisconnect 200 tscmd sandworm scott timeoutidle 120

14 Starting a Program in the Session tscmd sandworm scott initialprogram “wordpad.exe" tscmd sandworm scott workingdirectory c: tscmd sandworm scott inheritinitialprogram 0

15 Limitations to TSCMD.EXE  Functions on a per-user and per-server basis only  Not all settings exposed through this API  Requires the person running the command to be an administrator  Very limited error reporting  No built-in event logging

16 Using VBScript to Edit Settings  The Windows Scripting Host allows you to run VBScript from within the operating system  Windows Server 2003 has a new WMI provider that allows you to edit settings programmatically, using VBScript

17 What can VBScript Do that TSCMD can’t?  Here’s a short list:  Configure color depth for the session  Adjust mandatory encryption settings  Define the session directory location  Configure Time Zone redirection  Disadvantage: it takes longer to learn. Knowing TSCMD can be helpful for learning some values edited through WMI

18 Parts of a Script  Actions you can take  Things you can act on  Statements defining the conditions under which you’ll take those actions

19 Data Types  Numbers  Strings  Date/Time data  Boolean values

20 Variables and Constants  Both have assigned values—user input, object properties, or calculations from another part of the script  Variable values may change in the course of the script  Constant values do not change

21 Arrays  Groups of variables, as many as you like when you define the array  Array sizes may be static or dynamic  Can contain any data type: numbers, strings, date/time information, etc.  Find data by its index number (beginning with 0)  Arrays may have more than one index, but more than two gets confusing

22 Built-in Functions  Combined sets of instructions for doing things that are hard to do with the operators supported in VBScript  Several different kinds  String functions  Date and time functions  Array functions  Working-with data types functions  Mathematical functions  Other functions (InputBox, MsgBox)

23 String Functions  Character/ANSI conversion and checking  String Size  String Editing  Replacing text in a string

24 Date and Time Functions  Returning date and time information  Converting string data to a date/time  Returning and computing the date and time

25 Numeric Functions  General mathematical functions  Rounding functions  Random number generators

26 Array Functions  Join merges arrays  Split divides arrays

27 Functions for Working with Data  Determining data type  Conversion functions  Formatting

28 Other Functions  Input and output boxes  Error handling/notification  Determining engine version

29 Statements  If… Then  Select Case  Do… Loop  For… Next

30 Basics of WMI  WMI exposes underlying parts of the operating system to scripting languages such as VBScript. If a part is exposed, it’s said to have a provider.  You cannot access settings without a provider.  To edit a setting on a remote computer, that computer must support WMI and must have the provider the script refers to.

31 Terminal Services Support in WMI  The provider exposes TS-specific structures, including:  Sessions  Session environments  Remote control settings  Logon settings  To edit the settings, you enumerate the instances of these objects on the selected server

32 ADSI Objects  To get to the servers, you’ll often use ADSI  Any object found in a directory structure  User accounts, organizational units, domains, printers  Uses same property and method structure as WMI or file system objects  Not limited to Active Directory—works also for SAM and NDS—but namespace and syntax varies with the type of information you need

33 Key ASDI Functions and Methods  GetObject function connects to an object so you can access its properties and methods  GetInfo queries the directory structure and repopulates the local cache  Put sets a property in the local cache  SetInfo writes the cached value to the original object

34 Running a Script on Multiple Servers  Connect to the OU in which all terminal servers reside and run the script on all members of that OU  Store the names of all terminal servers in a file and input that file into the script  Accept server names as arguments to the script

35 Scripting Tips  Keep the lines in scripts short  Comment liberally  Mix case in your code to enhance readability  Use the WSH command-line environment  Name variables and constants according to data type  Explicitly define variables  Write scripts in a text editor

36 Summary  Use command-line tools to edit terminal settings more quickly and consistently  TSCMD.EXE for basic configuration  VBScript and WMI for more complex settings (Windows Server 2003 only)

37 Need More Information?  TSCMD.EXE is a free download from http://www.systemtools.com/free_frame.htm http://www.systemtools.com/free_frame.htm  Brief user guide to TSCMD.EXE at http://www.termservhub.com  My “Scripting Solutions” column in Windows and.NET Magazine offers step-by-step explanations of VBScript, WMI, and ADSI  Check out Microsoft’s script center at http://www.microsoft.com/technet/treeview/de fault.asp?url=/technet/scriptcenter/default.asp


Download ppt "Command-line control of Terminal Services Christa Anderson."

Similar presentations


Ads by Google