Using Command-Line Tools

   

Windows Server 2003 includes improved command-line management tools that allow you to complete most tasks without having to use a graphical user interface. This can increase efficiency for administrators desiring to use command-line functionality to automate common tasks. More than 60 new command-line tools are available in the Windows Server 2003 family. These include tools to manage key features such as print servers, Internet Information Services (IIS) 6.0, and Active Directory. Command-line management in Windows Server 2003 provides the following benefits:

  • Readiness for use.

    Solutions are ready to use out of the box with little or no extra coding required. All tools have a consistent, standard syntax with easy access to command-line documentation (/? Help text) as well as a comprehensive HTML Help file, ntcmds.chm (available from the Help and Support Center).

  • Support for remote management.

    All new tools support remote server operation via the /S parameter (remote system name ”for example, /S MyServer ), and they run under Telnet and Terminal Services, enabling fully remotable command-line management.

  • Scriptability.

    You can use batch files or scripts at the command line to create customized management solutions and automate common tool usage.

Command Shell

The command shell is a separate software program that provides direct communication between the user and the operating system. The nongraphical command shell user interface provides the environment in which you run character-based applications and utilities. The command shell executes programs and displays their output on the screen by using individual characters , much like the MS-DOS command interpreter Command.com. The Windows Server 2003 operating system command shell uses the command interpreter Cmd.exe, which loads applications and directs the flow of information between applications to translate user input into a form that the operating system understands.

The command shell provides many advantages that improve management efficiency. For example, you can

  • Use the command shell to create and edit batch files (also called scripts) to automate routine tasks. For example, you can use scripts to automate the management of user accounts or nightly backups .

  • Use the command-line version of Windows Script Host, CScript, to run more sophisticated scripts in the command shell.

  • Perform operations more efficiently by using batch files instead of the user interface. Batch files accept all commands that are available at the command line.

  • Customize the command prompt window for easier viewing to increase control over how you run programs.

Command-Line Tools

The following list shows the updated and new Windows Server 2003 family command-line tools:

  • Adprep.

    Prepares Windows 2000 domains and forests for upgrade to Windows Server 2003, Standard Edition, Enterprise Edition, or Datacenter Edition.

  • bootcfg.

    Configures, queries, or changes Boot.ini file settings.

  • choice.

    Prompts the user to make a choice by displaying a prompt and pausing, waiting for the user to choose from a set of options before continuing.

  • clip.

    Redirects command output from the command line to the Clipboard.

  • cmdkey.

    Creates, lists, and deletes stored user names and passwords or credentials.

  • defrag.

    Locates and consolidates fragmented boot files, data files, and folders on local volumes .

  • diskpart.

    Manages disks, partitions, or volumes.

  • driverquery.

    Queries for a list of drivers and driver properties.

  • dsadd.

    Adds a computer, contact, group , organizational unit, or user to a directory.

  • dsget.

    Displays selected attributes of a computer, contact, group, organizational unit, server, or user in a directory.

  • dsmod.

    Modifies an existing user, computer, contact, group, or organizational unit in a directory.

  • dsmove.

    Moves any object from its current location in the directory to a new location (as long as the move can be accommodated within a single domain controller) and renames an object without moving it in the directory tree.

  • dsquery .

    Queries and finds a list of computers, groups, organizational units, servers, or users in the directory using specified search criteria.

  • dsrm.

    Deletes an object of a specific type or any general object from the directory.

  • eventcreate.

    Enables an administrator to create a custom event in a specified event log.

  • eventquery.

    Lists the events and event properties from one or more event logs.

  • eventtriggers.

    Displays and configures event triggers on local or remote machines.

  • forfiles.

    Selects files in a folder or tree for batch processing.

  • freedisk.

    Checks for available disk space before continuing with an installation process.

  • fsutil .

    Manages reparse points and sparse files; dismounts or extends a volume.

  • getmac.

    Obtains the media access control (MAC) address and list of network protocols.

  • gettype.

    Sets the system environment variable %ERRORLEVEL% to the value associated with the specified information about the Windows operating system.

  • gpresult.

    Displays Group Policy settings and RSoP for a user or a computer.

  • helpctr.

    Starts the Help and Support Center.

  • inuse.

    Replaces locked operating system files.

  • iisback.

    Creates and manages backup copies of the IIS configuration (metabase and schema) of a remote or local computer.

  • iiscnfg.

    Imports and exports all or selected parts of the configuration of IIS on a local or remote computer.

  • iisftp .

    Creates, deletes, and lists FTP sites on servers that are running IIS 6.0. Also starts, stops, pauses, and continues FTP sites.

  • iisftpdr.

    Creates and deletes virtual directories of FTP sites on servers that are running IIS 6.0 or later.

  • iisvdir.

    Creates and deletes virtual directories of Web sites on servers that are running IIS 6.0 or later.

  • iisweb.

    Creates, deletes, and lists Web sites on servers that are running IIS 6.0. Also starts, stops, pauses, and continues the Web sites.

  • logman.

    Manages and schedules performance counter and event trace log collections on local and remote systems.

  • nlb.

    Replaces wlbs.exe for managing and controlling network load balancing operations.

  • nlbmgr.

    Configures and manages network load balancing clusters and all cluster hosts from a single computer.

  • openfiles.

    Queries, displays, or disconnects open files.

  • pagefileconfig.

    Displays and configures the paging file virtual memory settings of a system.

  • perfmon.

    Enables you to open a Performance console configured with settings files from the Windows NT 4.0 version of Performance Monitor.

  • prncnfg.

    Configures or displays configuration information about a printer.

  • prndrvr.

    Adds, deletes, and lists printer drivers from local or remote print servers.

  • prnjobs.

    Pauses, resumes, cancels, and lists print jobs.

  • prnmngr.

    Adds, deletes, and lists printers or printer connections, in addition to setting and displaying the default printer.

  • prnport.

    Creates, deletes, and lists standard TCP/IP printer ports, in addition to displaying and changing port configuration.

  • prnqctl.

    Prints a test page, pauses or resumes a printer, and clears a printer queue.

  • relog.

    Extracts performance counters from performance counter logs into other formats, such as text-TSV (for tab-delimited text), text-CSV (for comma-delimited text), binary-BIN, or SQL.

  • rss.

    Enables Remote Storage, which is used for extending server disk space.

  • sc.

    Retrieves and sets information about services. Tests and debugs service programs.

  • schtasks .

    Schedules commands and programs to run periodically or at a specific time. Adds and removes tasks from the schedule, starts and stops tasks on demand, and displays and changes scheduled tasks.

  • setx.

    Sets environment variables in the local or system environment, without requiring programming or scripting.

  • shutdown.

    Shuts down or restarts a local or remote computer.

  • systeminfo.

    Queries the system for basic system configuration information.

  • takeown.

    Allows an administrator to recover access to a file by making the administrator the owner of the file.

  • taskkill.

    Ends one or more tasks or processes.

  • tasklist.

    Displays a list of applications, services, and the Process Identifier (PID) currently running on either a local or a remote ­computer.

  • timeout.

    Pauses the command processor for the specified number of seconds.

  • tracerpt.

    Processes event trace logs or real-time data from instrumented event trace providers and allows you to generate trace analysis reports and CSV (comma-delimited) files for the events generated.

  • tsecimp.

    Imports assignment information from an XML file into the TAPI server security file (tsec.ini).

  • typeperf.

    Writes performance counter data to the command window or to a supported log file format.

  • waitfor.

    Uses signals to synchronize multiple computers across a network.

  • where.

    Locates and displays all files that match the given parameter.

  • whoami.

    Returns domain or computer name, user name, group names, logon identifier, and privileges for the currently logged-on user.

  • WMIC.

    Eases the use of WMI and systems managed through WMI.

WMI Command Line

The WMI Command Line (WMIC) utility provides a simple command-line interface to WMI. WMIC lets you take advantage of WMI to manage computers running Windows. WMIC interoperates with existing shells and utility commands and can be easily extended by scripts or other administration-oriented applications. WMIC allows you to

  • Browse the WMI schemas and query their classes and instances, as well as call and execute methods , usually using aliases (friendly names), which make WMI more intuitive.

  • Work with the local computer, remote computers, or multiple computers in a single command.

  • Customize aliases and output formats to suit your needs.

  • Create and execute scripts based on WMIC.

WMI providers are available to allow WMI to manage a wide variety of hardware components , operating system subsystems, and application systems. WMIC can be used with all the schemas implemented by those WMI providers. WMIC can be used from any computer running Windows XP Professional or a member of the Windows Server 2003 family to remotely manage any ­computer with WMI that is a Windows domain member. WMIC does not have to be available on the remotely managed computer to manage it.

Here are some examples of using WMIC to ease tasks:

  • Local management of a computer.

    You are at the computer and use the WMIC command to manage it.

  • Remote management of a computer.

    You are at one computer and use WMIC to manage another computer.

  • Remote management of multiple computers.

    You are at one computer and use WMIC to manage multiple computers with a single command.

  • Remote management of a computer (using a remote session).

    You use a remote sessioning technology (such as Telnet or Terminal Services) to connect to a remote computer and manage it with WMIC.

  • Automated management using administrative scripting.

    You use WMIC to write a simple management script (batch files) to automate the management of one or more computers (local or remote).

The WMI infrastructure is accessible to you as you use WMIC through intermediate facilitators called aliases . Aliases are friendly names used to capture the features of a WMI class that are relevant to some specific task, such as disk or network administration. Aliases can be used to provide better names for WMI classes, properties, and methods or to arrange properties in useful output formats. The output formats can include specific property values or can be formatted in a manner appropriate to some specific presentation strategy or function. For example, an alias might have a brief format that will list only property values essential for the identification of the objects visible through the alias. Management data is retrieved in XML format and processed by built-in or custom XSL output formats.


   
Top


Introducing Microsoft Windows Server 2003
Introducing Microsoft Windows Server(TM) 2003
ISBN: 0735615705
EAN: 2147483647
Year: 2005
Pages: 153

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net