SYSTEMINFO: Returning System Configuration Data
If you want to get information about various aspects of your computer, a good place to start is the SYSTEMINFO command-line tool, which displays data about the following aspects of your system:
The operating system name, version, and configuration type
The registered owner and organization
The original install date
The system uptime
The computer manufacturer, make, and model
The system processors
The BIOS version
The total and available physical memory
The paging file’s maximum size, available size, in-use value, and location
The installed hotfixes
The
network interface card data, such as the name, connection, Dynamic Host
Configuration Protocol (DHCP) status, and IP address (or addresses)
You can see all this data (and more), as well as control the output, by running SYSTEMINFO with the following syntax:
SYSTEMINFO [/S ComputerName] [/U [Domain]\UserName] [/P Password] [/FO Format] [/NH]
/S ComputerName | The name of the remote computer for which you want to view the system configuration. |
/U [Domain]\UserName | The username and, optionally, the domain, of the account under which you want to run the SYSTEMINFO command. |
/P Password | The password of the account you specified with /U. |
/FO Format | The output format, where format is one of the following values: |
| table—The output is displayed in a row-and-column format, with headers in the first row and values in subsequent rows. |
| list—The output is displayed in a two-column list, with the headers in the first column and values in the second column. |
| csv—The output is displayed with headers and values separated by commas. The headers appear on the first line. |
/NH | Tells SYSTEMINFO not to include column headers when you use the /FO switch with either table or csv. |
The output of SYSTEMINFO is quite long, so pipe it through the MORE command to see the output one screen at a time:
If you want to examine the output in another program
or import the results into Excel or Access, redirect the output to a
file and use the appropriate format. For example, Excel can read .csv files, so you can redirect the SYSTEMINFO output to a .csv file while using csv as the output format:
systeminfo /fo csv > systeminfo.csv
TYPEPERF: Monitoring Performance
You can get the same benefit without the System Monitor GUI by using the powerful TYPEPERF command-line tool. Here’s the syntax:
TYPEPERF [counter1 [counter2 ...]] [-CF file] [-O file] [-F format]
[-SI interval] [-SC samples] [-Q [object]] [-QX [object]] [-CONFIG file] [-S computer]
counter1 [counter2 ...] | Specifies
the path of the performance counter to monitor. If you want to track
multiple counters, separate each counter path with a space. If any path
includes spaces, surround the path with quotation marks. |
-CF file | Loads the counters from file, where file is a text file that lists the counter paths on separate lines. |
-O file | Specifies the path and name of the file that will store the performance data. |
-F format | Specifies the format for the output file format given by the /O switch, where format is one of the following values: |
| csv—The
output is displayed with each counter separated by a comma and each
sample on its own line. This is the default output format. |
| tsv—The output is displayed with each counter separated by a tab and each sample on its own line. |
| bin—The output is displayed in binary format. |
| sql—The output is displayed in SQL log format. |
-SI interval | Specifies the time interval between samples. The interval parameter uses the form [mm:]ss. The default interval is 1 second. |
-SC samples | Specifies the number of samples to collect. If you omit this switch, TYPEPERF samples continuously until you press Ctrl+C to cancel. |
-Q [object] | Lists the available counters for object without instances. |
-QX [object] | Lists the available counters for object with instances. |
-CONFIG file | Specifies the pathname of the settings file that contains the TYPEPERF parameters you want to run. |
-S computer | Specifies that the performance counters should be monitored on the PC named computer if no computer name is specified in the counter path. |
-Y | Answers yes to any prompts generated by TYPEPERF. |
The official syntax of a counter path looks like this:
[\\Computer]\Object([Parent/][Instance][#Index])\Counter
Computer | The computer on which the counter is to be monitored. If you omit a computer name, TYPEPERF monitors the counter on the local computer. |
Object | The performance object—such as Processor, Memory, or PhysicalDisk—that contains the counter. |
Parent | The container instance of the specified Instance. |
Instance | The instance of the Object, if it has multiple instances. For example, in a two- (or dual-core) processor system, the instances are 0 (for the first processor), 1 (for the second processor), or _Total (for both processors combined). You can also using an asterisk (*) to represent all the instances in Object. |
Index | The index number of the specified Instance. |
Counter | The name of the performance counter. You can also use an asterisk (*) to represent all the counters in Object (Instance). |
In practice, however, you rarely use the Computer, Parent, and Index parts of the path, so most counter paths use one of the following two formats:
\Object\Counter
\Object(Instance)\Counter
For example, here’s the path for the Memory object’s Available MBytes counter:
Here’s a TYPEPERF command that displays five samples of this counter:
typeperf "\Memory\Available Mbytes" -sc 5
Similarly, here’s the path for the Processor object’s % Processor Time counter, using the first processor instance:
\Processor(0)\% Processor Time
Here’s a TYPEPERF command that displays 10 samples of this counter every 3 seconds and saves the results to a file named ProcessorTime.txt:
typeperf "\Processor(0)\% Processor Time" -sc 10 -si 3 -o ProcessorTime.txt
To use the -CONFIG parameter with TYPEPERF,
you need to create a text file that stores the command-line parameters
you want to use. This configuration file consists of a series of
parameter/value pairs that use the following general format:
Here, Parameter is text that specifies a TYPEPERF parameter—such as F for the -F parameter and S for the -S parameter. Use C to specify one or more counter paths—and Value as the value you want to assign to the parameter.
For example, consider the following command:
typeperf "\PhysicalDisk(_Total)\% Idle Time" -si 5 -sc 10 -o idletime.txt
To run the same command using the -CONFIG parameter, you first need to create a file with the following text:
[c]
\PhysicalDisk(_Total)\% Idle Time
[si]
5
[sc]
10
[o]
idletime.txt
If this file is named IdleTimeCounter.txt, you can run it at any time with the following command (assuming IdleTimeCounter.txt resides in the current folder):
typeperf -config IdleTimeCounter.txt
WHOAMI: Getting Information About the Current User
The WHOAMI command gives you information about the user who is currently logged on to the computer:
WHOAMI [/UPN | /FQDN | LOGONID] [/USER | /GROUPS | /PRIV] [/ALL] [/FO format]
/UPN | (Domains only) Returns the current user’s name using the user principal name (UPN) format. |
/FQDN | (Domains only) Returns the current user’s name using the fully qualified domain name (FQDN) format. |
/LOGONID | Returns the current user’s security identifier (SID). |
/USER | Returns the current username using the computer\user format. |
/GROUPS | Returns the groups of which the current user is a member. |
/PRIV | Returns the current user’s privileges. |
/ALL | Returns the current user’s SID, username, groups, and privileges. |
/FO format | The output format, where format is one of the following values: |
| table—The output is displayed in a row-and-column format, with headers in the first row and values in subsequent rows. |
| list—The output is displayed in a two-column list, with the headers in the first column and values in the second column. |
| csv—The output is displayed with headers and values separated by commas. The headers appear on the first line. |
You probably won’t use this command often on the
Windows Home Server computer because you’ll almost always be logged on
as Administrator. However, WHOAMI is useful when you’re working on a client computer and you’re not sure who is currently logged on.
For example, the following command redirects the current user’s SID, username, groups, and privileges to a file named whoami.txt using the list format:
whoami /all /fo list > whoami.txt