Professor Windows - September 2002
Windows XP Tips and Tricks
By Yossi Saharon
Ziv Eden, Test Lead, Microsoft Israel
A lot has been said and written about the new features & capabilities of Windows XP Professional, yet it's always good to come across a useful list of some time-saving tools & tips which make our job a whole lot easier, and not less importantly - more fun. This column does just that - it's a cool and helpful list of tips & advice that you will love to be familiar with when running Windows XP Professional.
If you're one of those people who cannot go through a period of time without opening a command shell and running "something /?" (like myself), this section is for you. Windows XP truly enhances our work from the command line. It has many new tools, plus some improved tools, and also some scripts and tools coming from the resource kit to become part of the OS. There are almost 50 new tools added to Windows XP. Of them 11 tools migrated from the resource kit into the box (system32 folder) and over 30 are new tools built for XP. Tools such as SchTasks.exe (that replaces AT.exe in automation of task scheduling) and SC.exe (service controller tool to manage/start/stop/diagnose all Win32 services) are a couple of trivial examples, but there are many more. There are six new printing tools (named PRN*.vbs) and NetSH.exe has new network diagnostics tools (taken from Windows ME). The "old" secedit.exe was replaced with GPUpdate (used to refresh group policy information). There are 4 Performance Log Tools - LogMan, ReLog, TypePerf and TraceRpt. There are also 6 new Active Directory management tools – DSQuery, DSGet, DSAdd, DSMod, Dsmove and DSRm (delete), used to manage objects such as users, computers etc in an Active Directory domain. Finally, there are 2 disk management tools: Diskpart.exe (for partitions) and FSutil.exe (for file system management).
But let's start with a very handy help file named ntcmds.chm. This cool .chm file documents CMD.exe for environment variables, batch syntax, configuration settings and basically every command shell option. just type HH "ntcmds.chm" to access this unique help file.
In addition, responding to system events becomes much easier with Windows XP – you can use three new command line tools to create an event trigger, and if needed, to create a specific event into the event viewer as well. EVENTTRIGGERS.exe can be used to create a custom trigger to react to a certain event ID. If this event happens, you can run a certain file or application as a response. For example, you may want to run a certain cleanup script when your hard disk reaches low disk space. You can also test your event trigger by creating an event proactively using EVENTCREATE.exe, which is also a new command-line tool for Windows XP. There is also a tool named EVENTQUERY.exe, which is used to query for events .
Manipulating your boot.ini file can now be done through BOOTCFG.exe. BOOTCFG allows you to configure, query and change your boot.ini file settings. This tool is also included in Windows .NET Server, and it also includes a special switch (/EMS) to configure the Emergency Management Services for a certain boot entry, when working with a headless server configuration, for example.
If you want to get a quick list of information on your machine (or any other remote machine, using the /S switch), you can use SYSTEMINFO.exe. This useful tool dumps information such as Operating System type and version, install date, uptime, processors, memory, domain, hotfixes etc. It can also output the information into formats such as CSV, a table or a regular list (using the /FO switch).
Yet, the most refreshing change at the command-line is definitely the new WMI Command-line, or WMIC. WMIC provides a simple command-line interface to Windows Management Instrumentation (WMI). In general, WMI uses Providers that are available to allow managing a wide variety of hardware components, operating system subsystems, and application systems. WMIC enables you to perform operations you needed to script or code prior to the introduction of this tool. It's useful to manage computers running Windows and it interoperates with existing shells and utility commands. You can work with the local computer, remote computers, or multiple computers in a single command. WMIC does not have to be available on the remotely managed computer in order for WMIC to manage it.
It's extremely useful when you want to manage a change across a group of computers. For example, if you want to disable a certain Service for a bunch of PCs, just create a text file with the list of host names, and try the following:
WMIC /NODE:@"c:\\ComputerList.txt" SERVICE WHERE caption=
"The Service Name" CALL ChangeStartMode "Disabled"
This will change the start mode of the Service you specify to "disabled" on every computer in the text file list.
Note You need to be a local administrator on every computer in the list in order for the script to succeed.
It's Good to Know That
Here's a list of information about Windows XP Professional you might find useful.
Administration Tools Pack (adminpak.msi): Windows XP uses the Windows .NET Server adminpak.msi. At the time of this writing, the latest version of the server administration tools (adminpak.msi) for Windows .NET Server is the RC1 version and can be downloaded from here. Please note that there are quite a list of notes and issues you need to be aware of when running these tools from Windows XP. For example, you must remove (uninstall) the beta 3 adminpak.msi if it has been previously installed on the machine prior to installing the RC1 adminpak.msi file. All the different issues and things you need to know can be found at Microsoft Knowledge Base (KB) article 304718. Make sure you read this KB article before installing or attempting to work with those tools on Windows XP.
Active Directory Users & Computers MMC: When working with the Windows .NET adminpak.msi, Windows XP-based computers that are joined to Windows 2000-based domain controller domains do not support the enhanced functionality to select multiple users and to make bulk edits for attributes such as the home folder or the profile path. The multiple-select functionality is supported in forests in which the schema was extended to allow Windows .NET Server domain controllers. Also, when working with the Windows .NET Server RC1 administration tools pack, pay attention that RC1 AD MMCs introduce LDAP signing. Windows 2000 domain controllers must either have Windows 2000 Service Pack 3 installed, or Windows XP-based clients must have a registry change that is described in 325465: Windows 2000 Domain Controllers Require SP3 or Later When Using Windows .NET Server Administration Tools.
Speaking of the Active Directory MMC Snap-ins, I introduced the following tip in one of my previous columns: If you wish to extract only the AD MMC Snap-ins from the adminpak.msi file, use the following command syntax:
msiexec /i adminpak.msi ADDLOCAL= FeADTools /qb
(Where FeADTools is the abbreviation for "Active Directory Tools". This will install only the AD-related MMC Snap-Ins).
Where have the setup boot diskettes gone?Well, in case you cannot boot from a CD-ROM, there are six Windows XP setup boot floppy disks which don't come with the product package. You can download them from this location: Obtaining Windows XP Setup Boot Disks (310994).
Remote Desktop Connection: On the Windows XP CD, under \SUPPORT\TOOLS you'll find a file called MSRDPCLI.exe. This file contains the setup for the Terminal Client Software (Remote Desktop Connection, or MSTSC.exe) for 9.x/2000 machines. You can run this file to install the new terminal client to perform Remote Control to your Windows XP Professional machines (as well as Windows Terminal-based Servers) from Windows 95/98, for example.
While we're discussing Terminal Server and Remote Desktop Connection, here's a small tool called 'Remote Control Add-On' that extends the Active Directory MMC with a custom action of 'Remote Control' when you right click a computer account (see screen shot here). Using this tool you can leverage Terminal Services technologies and connect to Windows 2000/.NET Terminal servers, as well as Windows XP Professional clients, straight from the AD MMC. Pay attention that this tool is not supported. You can download the Remote Control Add-On from Microsoft's Download Center.
Group Policies: By default, Windows XP clients apply their group policies asynchronously during boot and logon. Compared to Windows 2000 default of synchronous work during the boot and logon processes, this gives faster boot and login times to XP clients which don't have to wait for the network. While this is essentially a good thing, some administrators don't want to delay applying software installations or folder re-directions, and might wish to convert this behavior to be the same as in Windows 2000. You can make Windows XP Professional work synchronously during boot and logon processes by enabling the setting 'Always wait for the network at computer startup and logon', which is located in the Group Policy snap–in at the "Computer Configuration", under \Administrative Templates\System\Logon.
MSTSC /console - The MSTSC Help and Support topic incorrectly states that you can use the /console switch to connect to the console session (session 0) of a specified Windows 2000 Server. (mstsc.exe is the Remote Desktop Connection client, earlier known as TS Client). You cannot use the /console switch to connect to the console session of a Windows 2000 Server-based computer. However, you can use the /console switch to connect to the console session of a Windows XP Professional-based computer, or a Windows .NET Server.
Application Compatibility – If you're running into application compatibility issues, the following tools can help:
Application Compatibility Toolkit 2.0 for Windows XP-
WINIPCFG - just in case you got used to the graphic IP configuration tool of Windows 98, well, you can download a similar tool for Windows XP/2000 at:
NTBACKUP is not installed by default on the home version. You can find it on the Windows XP CD under \VALUEADD\MSFT\NTBACKUP directory.
Windows XP Service Pack 1 Changes
The goal of Windows XP SP1 is to fix customer reported bugs and improve the reliability, compatibility, security and deployability of Windows XP.
As I'm writing this column, Windows XP SP1 is scheduled to be released in the first half of September 2002.
Windows XP SP1 includes some important licensing & activation changes that you may want to note. For example, SP1 will not install on known pirated installations. Users of licensed Microsoft software will be unaffected. If SP1 is installed on a Windows XP desktop OS installation with a known pirated product ID, SP1 installation will fail and return an error. The below message will be displayed if installation fails for this reason:
"Service Pack 1 Setup Error-
The product key used to install Windows is invalid. Please contact your system administrator or retailer immediately to obtain a valid product key. You may also contact Microsoft Corporation's Anti-Piracy Team by emailing firstname.lastname@example.org if you think you have purchased pirated Microsoft software. Please be assured that any personal information you send to the Microsoft Anti-Piracy team will be kept in strict confidence."
You can find the product ID of your installation by right clicking on My Computer and choose Properties, then viewing the General tab. You can also find the product key in the registry at: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\ CurrentVersion\ProductId.
In addition, SP1 will contain fixes to known pirate cracks that bypass activation. Installations of Windows XP patched by one of these pirate cracks will require activation after SP1 has been installed. Windows XP installations that remain un-activated past the 30-day grace period can still be accessed for interactive use by booting to non-networked safe-mode.
Some very helpful changes were made as well to ease the burden of re-activating. For example, Windows XP SP1 will introduce an additional grace period for hardware out-of-tolerance situations. You will have a three-day grace period when asked to re-activate due to changes in your hardware configuration. Previous to SP1, a user was required to reactivate immediately upon boot if a significant hardware changes had occurred. With SP1, you will have three days to complete this re-activation. Obviously, a re-install of the operating system will reset this counter.
Another important and helpful change is the new Volume License Key (VLK) Encryption. This feature is added to unattended setups of Windows XP with Service Pack 1, and is applicable to customers with volume licensing agreements such as Select, Enterprise Agreement (EA) and Open License. Customers who place their VLK in an unattended setup file (unattend.txt) will be able to encrypt the VLK such that it will be time limited (in day increments from 5 to 60 days) and not visible as plain text. So how will we use this new feature? well, suppose you want to protect your SMS-based or CD-based installs of Windows XP one at a time, for 30 days:
First, obtain volume licensing media of Windows XP (SP1 Integrated version)
from a command line, run:
winnt32 /encrypt: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX:30 /unattend:unattend.txt
The resultant hash is written to specified unattend file, replacing any existing ProductKey or ProductID entries. Any errors or success will result in a displayed message.
Media is useful until date of encryption + 30 days (+24/-12 hours of the current time in GMT to allow for GMT offset)
For non-read-only media, the steps above can be reproduced repeatedly to ensure a new encrypted key and to always have media available.
For any feedback regarding the content of this column, please write to Microsoft TechNet. Please be aware that a response is not guaranteed.