• No results found

The command prompt remains unchanged in WS08, but individual commands have been added to make it more powerful. The major advantage of the command prompt is that it provides a character-based interface for performing server operations. This means that you can capture each of these commands into a script or batch file that provides consistent experiences because it always repeats the same actions. In addition, the command prompt supports piping the results of a command into a text file. This means that when a command runs, its results are stored in a text file that you can review at a later date.

This is useful, because you can use it to run deferred commands and then review the results at a later time. Administrators can use this to create a series of different batch or command files—with the .cmd or .bat file extension—and schedule them to run through the Windows Task Scheduler. The results are piped into text files that can even be stored in one single location. For example, if you want to know the status of your servers, you can use the following command:

systeminfo /s computername >filename.txt

where computername references the name of the server you want to investigate. If omitted, it lists information about the local server. Use filename.txt to identify the name and path of the file you want to send the information to. You can put a series of these commands in a single

PA

RT

I

PA

RT

I

PA

RT

I

command file and schedule them to automatically generate the output files every day. This helps you quickly identify the state of all services in your network.

NOTE

NOTE

This is the approach that is used in Chapter 13 as we discuss the automation of most of the more than 150 administrative tasks you need to perform to maintain a WS08 environment. WS08 includes several new commands for server administration. Many will be covered as we deal with the actual task, but if you want a complete list, check out Table 2-2.

Command Description

auditpol Modifies audit policies bcdedit Boot configuration data editor

change Sets special terminal server modes for logons, COM port mappings, and software installations

chglogon Controls session logins

chgport Controls COM port mappings for DOS application compatibility chgusr Changes application installation mode

choice Lets you select one item from a list of choices and returns the result clip Used to redirect output from the command line to the Clipboard cmdkey Controls stored usernames and passwords

diskraid Used to access the Diskraid command window dispdiag Displays diagnostics

forfiles Used to select a file or files to execute a command on it; used mostly in batch jobs

icacls Controls access control lists (ACLs) on files iscsicli Initiates iSCSI

mklink Creates symbolic links and hard links

muiunattend Control Multiple User Interface (MUI) unattend actions netcfg Network installer for Windows PE (WinPE)

ocsetup Windows optional component setup; useful for Server Core

pkgmgr Windows Package Manager

pnpunattend Unattended online driver installation pnputil Microsoft Plug and Play (PnP) utility

quser Displays information about users logged on to the system robocopy Robust file copy for Windows; formerly in the Resource Kit

Windows PowerShell

You can continue to work with the command shell, and in many cases, you will need to continue to do so, but the most powerful command language in any Windows system today is the Windows PowerShell. The command prompt hasn’t been updated since the first release of Windows NT, so it is high time that a new shell environment was made available. Windows PowerShell must be added as a feature, and then it can be launched through a shortcut in the Start menu. Windows PowerShell provides a complete command environment replete with automated command completion, instant help, and many forms of administrative assistance.

Windows PowerShell is based on the .NET Framework and requires it to run. This means a few things. First, it does not run on Server Core, the bare-bones edition of Windows Server 2008, since Server Core does not include a graphical interface and the .NET Framework has UI dependencies, though Microsoft is working on fixing this. You will need to continue using the traditional command shell if you deploy Server Core in your network, as this is the only

Command Description

rpcping Pings a server using remote procedure call (RPC)

setx Controls environmental variables in the user or system environment servermanagercmd Provides command-line support for all the Server Manager Console

functionalities

sxstrace Windows side-by-side (WinSxS) tracing tool takeown Controls file ownership

timeout Controls wait times in batch files tracerpt Used to generate trace reports

waitfor Used to send, or wait for, a signal on a system: Use /S to send the signal to a specified system Omit /S to send the signal to all systems in a domain wbadmin Controls backups and restores

wceutil Controls the Windows Event Collector wevtutil Controls Windows events

where Used to display the location of files matching a given search

whoami Gets username and group information, along with security identifiers (SIDs), privileges, and logon identifier (logon ID) for the current user (access token) on the local system

winrm Controls Windows remote management

winrs Launches the Windows remote shell

winsat Launches the Windows system assessment tool

PA

RT

I

PA

RT

I

PA

RT

I

interface available locally on these servers. Second, Windows PowerShell is not a replacement for all the other administrative tools available in WS08. It is a tool that is designed to assist in the automation of repetitive tasks. As such, it is very powerful.

Another nice aspect of Windows PowerShell is that it supports the concept of an alias for a command, and the Windows PowerShell team has created and included aliases for all of the existing command-shell commands. In fact, to use Windows PowerShell, you don’t actually need to learn anything so long as you are familiar with the existing command prompt. But if you want to unleash the power of Windows PowerShell, you’ll make a point of learning all of its commands—called cmdlets—and avoid using the outdated aliases.

It’s easy to learn any command in Windows PowerShell. All you need is to know two things. The first is that when you type a command in Windows PowerShell, you can use the tab key to automatically complete it and cycle through all of its potential options. The second is to know the cmdlet Get-. Get- is used to obtain information from Windows PowerShell. For example, Get-Help will provide you with help on Windows PowerShell. So if you type

Get- in the cmdlet and then press the tab key, Windows PowerShell will cycle through all of the available commands. This should provide you with an extensive amount of information on the other cmdlets you can run. Remember to include the trailing hyphen, as the command is not recognized without it.

NOTE

NOTE

You’ll be able to recognize the Windows PowerShell from the default command shell by its leading “PS” in front of the command prompt.

TIP

TIP

You might be familiar with a useful Windows power toy called “Command Prompt Here.” It automatically opens a command prompt at the right location when you right-click a folder and use the power toy. It saves you from having to type long and convoluted folder names. Windows PowerShell also has this power toy. You can get the “PowerShell Prompt Here” power toy from www.hanselman.com/blog/IntroducingPowerShellPromptHere.aspx.

More on Windows PowerShell will be covered as we describe the administrative commands you need to rely on to maintain your server infrastructure.

NOTE

NOTE

To learn more about Windows PowerShell, examine the documents in the PowerShell Documents folder (in the Start menu), or go to www.microsoft.com/windowsserver2003/ technologies/management/powershell/default.mspx. There is a handy little four-fold sheet named “QuadFold.rtf” in the Documents folder that lists all Windows PowerShell shortcuts and syntax.

Help and Support in WS08

Another useful tool to newcomers in WS08 is the Help & Support Center (HSC). This center is designed to demystify all of the features and interactions you will have with WS08. The home page of the Help & Support Center leads you directly to what you want to know. Because of this, you should keep in mind the most important key in any Windows environment, the f1

key. Pressing f1 at any time, or even on a empty desktop, will automatically open HSC. Of

course, you can launch HSC from the Start menu, but f1 is often faster and easier.

Help content is regularly updated with patches and updates, but it is also directly linked to online content, so it should always up to date. Of course, isolated server

environments will not have this luxury, but you can always use another system to get the information.

HSC is really useful when you first start working with an operating system, so make sure you browse through it and take the time to understand its structure and content as it evolves with time.