CONTENTS |
UNIX system administration is performed mostly from the command line. There are very good system administration interfaces through which many routine system administration tasks can be performed; however, the command line is still used before any graphical tool for most UNIX system administrators. The converse is true for Windows. With Windows, most system administration functions are performed with "point and click." There are, however, many functions you can perform from the command line in Windows. In this UNIX and Windows interoperability chapter, I will cover the Windows command line in general and a group of POSIX utilities that give you UNIX functionality in Windows in particular.
I'll begin with Windows "NET" commands, which are system administration commands for Windows. I'll then cover the POSIX commands that you can run at the Windows command line that give you UNIX functionality in Windows, such as grep, ls, andsoon. I'll finally cover some additional Windows commands that you can issue to perform such tasks as backup and running a command at a specific time.
The POSIX commands are what really constitute the UNIX and Windows portion of this chapter. I think, however, that covering the other Windows commands gives UNIX system administrators an idea of the types of Windows system administration commands available.
The whole Windows operating system is based on performing system administration tasks through the graphical user interface. Why, then, would I include a chapter on the command line? Well, many of us have used operating systems for which the lion's share of system administration work takes place at the command line - and old habits die hard.
The purpose of this chapter is to demonstrate some useful commands that are issued at the command line. You can then decide whether using such commands is helpful to the administration of your Windows server or whether you wish to use only the graphical user interface of Windows.
This section describes some of the net commands of Windows. Here is a list of some widely used net commands and a brief explanation of each:
net accounts | Used to maintain the user accounts database. |
net computer | Used to add or delete computers from the domain database. |
net config server | |
Displays or changes settings for a server service on which the command is executed. | |
net config workstation | |
Displays or changes settings for the workstation service on which the command is executed. | |
net continue | Reactivates a Windows service that has been suspended with the net pause command. |
net file | Used for network file manipulation, such as listing ID numbers, closing a shared file, removing file locks, and so on. |
net group | Used to add, display, or modify global groups on servers. |
net help | Displays a listing of help options for any net command. |
net helpmsg | Displays explanations of Windows network messages, such as errors, warnings, and alerts. |
net localgroup | Used to modify local groups on computers. |
net name | Used to add or delete a "messaging name" at a computer, which is the name to which messages are sent. |
net print | Used to list print jobs and shared queues. |
net send | Sends messages to other users, computers, and "messaging names" on the network. |
net session | Used to list or disconnect sessions between the computer and other computers on the network. |
net share | Shares a server's resources with other computers on the network. |
net start | Used to start services such as server. |
net statistics | Displays the statistics log for the local Workstation or Server service. |
net stop | Used to stop services such as server. |
net time | Synchronizes the computer's clock with another computer on the domain. |
net use | Displays, connects, or disconnects a computer with shared resources. |
net user | Creates or modifies user accounts. |
net view | Lists resources being shared on a computer. |
The following are brief descriptions of some of the NET commands and examples of using them.
Many of the descriptions include command summaries that were obtained by typing the command name followed by /?. For instance, to get a command summary for the NET ACCOUNTS command, you would type the following:
C:\ NET ACCOUNTS /?
You can also get detailed help information by typing HELP and the command name, as shown in the following example:
C:\ HELP NET ACCOUNTS
NET ACCOUNTS - Maintains user account database.
The following is a summary of the NET ACCOUNTS command:
C:\ NET ACCOUNTS /? NET ACCOUNTS [/FORCELOGOFF:{minutes | NO}] [/MINPWLEN:length] [/MAXPWAGE:{days | UNLIMITED}] [/MINPWAGE:days] [/UNIQUEPW:number] [/DOMAIN] NET ACCOUNTS [/SYNC]
Some commonly used options follow:
/DOMAIN | Perform the specified action on the domain controller rather than the current computer. |
/FORCELOGOFF | Line numbers are displayed, along with output lines. |
/MINPWLEN:length | Specify the minimum number of characters for a password with length. |
/MAXPWAGE:days | Specify the maximum number of days a password is valid, or use the unlimited option to specify no limit on password validity. |
/MINPWAGE:days | Specify the minimum number of days that must pass before a user is permitted to change their password. |
/UNIQUEPW:number | A user password must be unique for the number of changes specified by number. |
/SYNCH | Synchronize the account database. |
The following example shows NET ACCOUNTS with no options specified:
C:\ NET ACCOUNTS Force user logoff how long after time expires?: Never Minimum password age (days): 0 Maximum password age (days): 42 Minimum password length: 0 Length of password history maintained: None Lockout threshold: Never Lockout duration (minutes): 30 Lockout observation window (minutes): 30 Computer role: BACKUP Primary Domain controller for workstation domain: \\NISDEV The command completed successfully.
We'll now issue NET ACCOUNTS with the MINPWLEN option to change the minimum password length to five characters:
C:\ NET ACCOUNTS /MINPWLEN:5 The request will be processed at the primary domain controller for domain NSDNIS The command completed successfully.
Re-issuing NET ACCOUNTS with no options reflects the new minimum password length:
C:\ NET ACCOUNTS Force user logoff how long after time expires?: Never Minimum password age (days): 0 Maximum password age (days): 42 Minimum password length: 5 Length of password history maintained: None Lockout threshold: Never Lockout duration (minutes): 30 Lockout observation window (minutes): 30 Computer role: BACKUP Primary Domain controller for workstation domain: \\NISDEV The command completed successfully.
NET COMPUTER - Adds or deletes computers from the domain database.
The following is a summary of the NET COMPUTER command:
C:\ NET COMPUTER /? NET COMPUTER \\computername {/ADD | /DEL}
Some commonly used options follow:
\\computername | Name of the computer to be added or deleted. |
/ADD | Add the computer. |
/DEL | Delete the computer. |
The following example shows adding a computer using the / ADD option:
C:\ NET COMPUTER \\SYSTEM2 /ADD The request will be processed at the primary domain controller for domain NSDNIS. The command completed successfully.
NET CONFIG SERVER - As a member of Administrator's group, you can change the settings for a service.
The following is a summary of the NET CONFIG SERVER command:
C:\ NET CONFIG SERVER /? NET CONFIG SERVER [/AUTODISCONNECT:time] [/SRVCOMMENT:"text"] [/HIDDEN:{YES | NO}]
Some commonly used options follow:
/AUTODISCONNECT:time | Use time to specify the number of minutes that pass before an inactive account is disconnected. |
/SRVCOMMENT:"text" | |
/HIDDEN:{YES|NO} |
NET CONTINUE - Reactivates a Windows service that had been suspended with NET PAUSE.
The following is a summary of the NET CONTINUE command:
C:\ NET CONTINUE /? NET CONTINUE service
You can pause and continue many Windows services with the NET PAUSE and NET CONTINUE commands, respectively. The following example shows using the NET PAUSE command to pause the NET LOGON service and then restart it with the NET CONTINUE command.
Figure 30-1 is the Services dialog box from a system, showing some of the services running on a system:
We'll now use the NET PAUSE command to pause the Net Logon service:
C:\NET PAUSE NTLOGON The Net Logon service was paused successfully.
Figure 30-2 is the Services dialog box again, showing that the Net Logon service has indeed been paused:
We can now resume the Net Logon service with the following NET CONTINUE command:
C:\NET CONTINUE NTLOGON The Net Logon service was continued successfully.
NET FILE - This command lists and closes open files.
The following is a summary of the NET FILE command:
C:\ NET FILE /? NET FILE [id [/CLOSE]]
Some commonly used options follow:
id | Specify the identification number of the file you wish to view. |
id /CLOSE | Close the file specified by the id number. |
The following example shows issuing the NET FILE command with no options:
C:\ NET FILE ID Path User name # Locks ------------------------------------------------------------------------------- 97 C:\tif_map_proj\sql leung_k 0 147 \PIPE\samr administrator 0 148 \PIPE\lsarpc administrator 0 The command completed successfully.
This output shows the open files on the server. You can close one of these shared files or remove locks from the file.
NET GROUP - This command displays and allows you to manipulate groups on a server. Without specifying any option, this command lists groups.
The following is a summary of the NET GROUP command:
C:\ NET GROUP /? NET GROUP [groupname [/COMMENT:"text"]] [DOMAIN] groupname {/ADD [/COMMENT:"text"] | /DELETE} [/DOMAIN] groupname username [...] {/ADD | /DELETE} [/DOMAIN]
Some commonly used options follow:
/ADD | Add a group to a domain or a username to a group. |
/DELETE | Delete a group from a domain or a username from a group. |
groupname | Specify the groupname for the operation. With no options, the users who are part of the group are displayed. You can also use the ADD or DELETE options with the groupname to specify a username to add to the group. |
/COMMENT:"text" | Add this comment to the groupname. |
/DOMAIN | The operation will be performed on the primary domain controller. This option is the default for Windows server systems. |
username | This user will be added or removed from the group. Any number of users can be specified. |
The following example shows issuing the NET GROUP command to add the group hp consultants:
C:/ NET GROUP "hp consultants" /ADD The request will be processed at the primary domain controller for domain NSDNIS. The command completed successfully.
Next, we add the user marty to the group hp consultants on the local system:
C:\ NET GROUP "hp consultants" marty /ADD The request will be processed at the primary domain controller for domain NSDNIS. The command completed successfully.
Next, we add a comment to hp consultants:
C:\ NET GROUP "hp consultants" /COMMENT:"Group For HP Consultants" The request will be processed at the primary domain controller for domain NSDNIS. The command completed successfully.
We can now view our handiwork by looking at the information we have added associated with the group hp consultants:
C:\ NET GROUP "hp consultants" Group name hp consultants Comment Group For HP Consultants Members ------------------------------------------------------------------------------- marty The command completed successfully.
This output confirms that we have created the group hp consultants, that marty is a member of this group, and that our comment has indeed been associated with the group.
NET HELP - Use this command to get help on any of the NET commands.
A commonly used option follows:
NET HELP command | more | This provides information about the command you specify. |
The following example shows issuing the NET HELP command to get a list of commands for which help is available:
C:\ NET HELP The syntax of this command is: NET HELP command -or- NET command /HELP Commands available are: NET ACCOUNTS NET HELP NET SHARE NET COMPUTER NET HELPMSG NET START NET CONFIG NET LOCALGROUP NET STATISTICS NET CONFIG SERVER NET NAME NET STOP NET CONFIG WORKSTATION NET PAUSE NET TIME NET CONTINUE NET PRINT NET USE NET FILE NET SEND NET USER NET GROUP NET SESSION NET VIEW NET HELP SERVICES lists the network services you can start. NET HELP SYNTAX explains how to read NET HELP syntax lines. NET HELP command | MORE displays Help one screen at a time.
The following example shows issuing the NET HELP command to get information about the NET GROUP command:
C:\ NET HELP NET GROUP The syntax of this command is: NET GROUP [groupname [/COMMENT:"text"]] [/DOMAIN] groupname {/ADD [/COMMENT:"text"] | /DELETE} [/DOMAIN] groupname username [...] {/ADD | /DELETE} [/DOMAIN] NET GROUP adds, displays, or modifies global groups on servers. Used without parameters, it displays the groupnames on the server. groupname Is the name of the group to add, expand, or delete. Supply only a groupname to view a list of users in a group. /COMMENT:"text" Adds a comment for a new or existing group. The comment can have as many as 48 characters. Enclose the text in quotation marks. /DOMAIN Performs the operation on the primary domain controller of the current domain. Otherwise, the operation is performed on the local computer. This parameter applies only to Windows Workstation computers that are members of a Windows Server domain. By default, Windows Server computers perform operations on the primary domain controller. username[ ...] Lists one or more usernames to add to or remove from a group. Separate multiple username entries with a space. /ADD Adds a group, or adds a username to a group. /DELETE Removes a group, or removes a username from a group. NET HELP command | MORE displays Help one screen at a time.
NET HELPMSG - Gets information on four-digit network message codes. Use only the four digits to get information on the code.
The following is the format of the NET HELPMSG command:
NET HELPMSG message# | Provides information about the four-digit messagenumber you specify. |
The following command shows issuing the NET GROUP command to add a group to a system. After issuing this command, an error number is provided.
C:\ NET GROUP "hp consultants" /ADD The group already exists. More help is available by typing NET HELPMSG 2233.
We can now use the NET HELPMSG command to get information about the specific four-digit code:
C:\ NET HELPMSG 2223 The group already exists. EXPLANATION You tried to create a group with a group name that already exists. ACTION Use a different group name for the new group. To display a list of group names established on the server, type: NET GROUP
NET LOCALGROUP - This command displays and allows you to manipulate groups on a computer. Without specifying any option, this command lists groups.
The following is a summary of the NET LOCALGROUP command:
C:\ NET LOCALGROUP /? NET LOCALGROUP [groupname [/COMMENT:"text"]] [DOMAIN] groupname {/ADD [/COMMENT:"text"] | /DELETE} [/DOMAIN] groupname name [...] {/ADD | /DELETE} [/DOMAIN]
Some commonly used options follow:
/ADD | Add a group to a domain or a username to a group. |
/DELETE | Delete a group from a domain or a username from a group. |
groupname | Specify the groupname for the operation. With no options, the users who are part of the local group are displayed. You can also use the ADD or DELETE options with the groupname to specify a username to add to the group. |
/COMMENT:"text" | Add this comment to the groupname. |
/DOMAIN | The operation will be performed on the primary domain controller. If this option is not used, the operation will take place on the local computer. This is the default for Windows server systems. |
name | This is the user name(s) or group name(s) to be added or removed from the group. Any number can be specified. |
NET NAME - This command adds or deletes a messaging name from a computer. This command is not to be confused with NET USER, which adds or deletes user accounts on a system.
The following is a summary of the NET NAME command:
C:\ NET NAME /? NET NAME [name [/ADD | DELETE]]
Some commonly used options follow:
name | Name to add or delete. |
/ADD | Adds a name to the computer. |
/DELETE | Deletes a name from the computer. |
NET PAUSE - Suspends a Windows service.
The following is a summary of the NET PAUSE command:
C:\ NET PAUSE /? NET PAUSE service
You can pause and continue many Windows services with the NET PAUSE and NET CONTINUE commands, respectively. The following example shows using the NET PAUSE command to pause the NET LOGON service and then to restart it with the NET CONTINUE command.
Figure 30-3 shows the Services dialog box from a system, showing some of the services running on a system:
We now use the NET PAUSE command to pause the Net Logon service:
C:\NET PAUSE NTLOGON The Net Logon service was paused successfully.
Figure 30-4 is again the Services dialog box, this time showing that the Net Logon service has indeed been paused:
We can now continue the Net Logon service with the following
NET CONTINUE command:
C:\NET CONTINUE NTLOGON The Net Logon service was continued successfully.
NET PRINT - This command lists print jobs and shared queues.
The following is a command summary of the NET PRINT command:
C:\ NET PRINT /? NET PRINT \\computername\sharename [\\computername] job# [/HOLD | /RELEASE | /DELETE]
Some commonly used options follow:
\\computername | The computername sharing the print queues. |
sharename | The print queue sharename. |
job# | The unique number assigned to a print job. |
/HOLD | The job is assigned a status of HOLD, which means that it will not be printed until it is released or deleted. |
/RELEASE | Releases a print job so that it can be printed. |
/DELETE | Deletes a print job from the print queue. |
NET SEND - Sends messages to other users, computers, or messaging names on the network.
The following is a summary of the NET SEND command.
C:\ NET SEND /? NET SEND {name |*|/DOMAIN[:name] | /USERS} message
Some commonly used options follow:
name | The user name, computer name, or messaging name to which the message is to be sent. Use quotation marks if there are blank characters in the name. |
* | Use * to send a message to all users within your group rather than an individual name. |
/DOMAIN[:domainname] | Use /DOMAIN to send a message to all users in the / DOMAIN. You can also specify a domainname to which you want the message sent. |
message | This is the text message you want sent. |
The following example shows issuing the NET SEND command to send a message to a specific user:
NET SEND marty Our NetServer LXr has arrived for installation.
Figure 30-5 shows the alert box that appears on the screen of the computer on which marty is working.
NET SESSION - Views or disconnects sessions between computers.
The following is a summary of the NET SESSION command.
C:\ NET SESSION /? NET SESSION [\\computername] [/DELETE]
Some commonly used options follow:
\\computername | Lists session-related information for computername. |
/DELETE | Terminates a session between the local computer and computername, closing open files. Without a computername, all sessions are ended. |
NET SHARE - This command is used to list information about existing shares or to share a server's resources with other network users. The command lists information about existing shares if you don't specify any options.
The following is a summary of the NET SHARE command.
C:\ NET SHARE /? NET SHARE sharename sharename=drive:path [USERS:number | /UNLIMITED] [REMARK:"text"] sharename [/USERS:number | /UNLIMITED] [/REMARK:"text"] {sharename | devicename | drive:path} /DELETE
Some commonly used options follow:
sharename | Network name of the shared resource. Using the sharename only displays information about the share. |
devicename | Used to specify printers to be shared with sharename. Use LP1-LPT9 as a devicename. |
drive:path | Use this option to specify that a specific drive and path for a directory are to be shared. |
/USERS:number | Use this option to specify the maximum number of users that can simultaneously access a shared resource. |
/UNLIMITED | An unlimited number of users may simultaneously access a shared resource. |
/REMARK:"text" | Associates a remark with the specified shared resource. |
/DELETE | Sharing is deleted for the specified resource. |
Let's now use NET SHARE to set up a new share on a system. To begin, let's look at the existing shares using the NET SHARE command with no options:
D:\ NET SHARE Share name Resource Remark ------------------------------------------------------------------------------- ADMIN$ D:\WINNT Remote Admin IPC$ Remote IPC C$ C:\ Default share print$ D:\WINNT\system32\spool\drivers Printer Drivers D$ D:\ Default share E$ E:\ Default share net_share C:\net_share NETLOGON D:\WINNT\system32\Repl\Import\S Logon server share HPLaserJ5 LPT1: Spooled HP LaserJet 5MP The command completed successfully.
Now we can set up a share of the c:\measureware directory with a sharename of measure and a maximum number of five users:
C:\ NET SHARE measure=c:\measureware /users:5 measure was shared successfully
Issuing the NET SHARE command shows that the share named "measureware" has been established:
C:\ NET SHARE Share name Resource Remark ----------------------------------------------------------------------------- - D$ D:\ Default share ADMIN$ D:\WINNT Remote Admin IPC$ Remote IPC C$ C:\ Default share print$ D:\WINNT\system32\spool\drivers Printer Drivers E$ E:\ Default share measure c:\measureware net_share C:\net_share NETLOGON D:\WINNT\system32\Repl\Import\S Logon server share HPLaserJ5 LPT1: Spooled HP LaserJet 5MP The command completed successfully.
NET START - This command starts services that have been stopped using the NET STOP command or that have not been started. Issue NET START without options to see a list of currently running services.
The following is a summary of the NET START command:
C:\ NET START /? NET START [service]
The following example shows issuing the NET START command without any options to list currently running services:
C:/ NET START These Windows services are started: Alerter Computer Browser EventLog FTP Publishing Service Gateway Service for NetWare Gopher Publishing Service License Logging Service MeasureWare Agent MeasureWare Transaction Manager Messenger Net Logon NT LM Security Support Provider OracleServiceTMI OracleStartTMI OracleTNSListener Plug and Play Remote Procedure Call (RPC) Locator Remote Procedure Call (RPC) Service Schedule Server Spooler STP/A - TCP/IP Page Server (TMI) TCP/IP NetBIOS Helper UPS Workstation World Wide Web Publishing Service The command completed successfully.
There are many services listed in the example that are not native to Windows. For instance, MeasureWare (HP performance tools) and Oracle services. These can be started and stopped with the NET START and NET STOP commands, respectively.
NET STATISTICS - Use this command to display the statistics log for a service. Issue NET STATISTICS without options to display statistics for all services.
The following is a summary of the NET STATISTICS command:
C:\ NET STATISTICS /? NET STATISTICS [WORKSTATION | SERVER]
Some commonly used options follow:
SERVER | Displays server service statistics. |
WORKSTATION | Displays workstation service statistics. |
The following example shows issuing the NET STATISTICS command with no options:
C:\ NET STATISTICS Server Statistics for \\NISDEV Statistics since 1/21/98 8:49 AM Sessions accepted 3 Sessions timed-out 32 Sessions errored-out 32 Kilobytes sent 165941 Kilobytes received 33118 Mean response time (msec) 0 System errors 0 Permission violations 2 Password violations 0 Files accessed 12787 Communication devices accessed 0 Print jobs spooled 0 Times buffers exhausted Big buffers 0 Request buffers 0 The command completed successfully.
NET STOP - This command stops a service that was started using the NET START command.
The following is a summary of the NET STOP command:
C:\ NET STOP /? NET STOP service
One option to the NET STOP command is:
service | The name of a service that can be stopped. |
NET TIME - This command is used to display the time for a computer or to synchronize the clock of one computer with the clock of another computer.
The following is a summary of the NET TIME command.
C:\ NET TIME /? NET TIME [\\computername | /DOMAIN[:domainname]] [/SET]
Some commonly used options follow:
\\computername | The computer with which you want to synchronize the time or of which you want to display the time. |
/DOMAIN[:domainname] | The domain name with which you want to synchronize the time. |
/SET | Sets the computer's time with the time on the specified computer or domain. |
NET USE - Lists the connections of a computer, or establishes or removes shared resources. Without options, this command lists the connections of a computer.
The following is a summary of the NET USE command:
C:\ NET USE /? NET USE [devicename | *] [//computername\sharename[/volume] [password | *]] [/USER:[domainname\]username] [[/DELETE] | [/PERSISTENT:{YES | NO}]] NET USE [devicename | *] [password | *]] [/HOME] NET USE [PERSISTENT:{YES | NO}]
Some commonly used options follow:
devicename | Specifies a name to be connected or disconnected. The possibilities include such names as drives and printers. |
//computername | This is the name of the computer that controls the shared resource. |
/sharename | The network name of the shared device. |
password | The password that is required to get access to the shared resource. |
* | Produces a password prompt for the user attempting to use the shared resource. |
/USER | Specifies a different user name for the connection. |
domainname | A different domain from the current domain is used. |
username | Specifies a user logon name. |
/HOME | Connects a user to their home directory. |
/DELETE | Cancels a network connection and removes it from the list of persistent connections. |
/PERSISTENT {yes | no} | Specifying yes means that the connections are re-established at the next logon. Specifying no does not save the connection for future logons. |
The following example shows issuing the NET USE command with no options:
C:\ NET USE New connections will be remembered. Status Local Remote Network ------------------------------------------------------------------------------- OK P: \\DEVSYS\Disk_C Microsoft Windows Network The command completed successfully.
The directory Disk_C on remote system DEVSYS is viewed under P: on the local system.
NET USER - This command creates and modifies accounts on computers. This can also be used without options to list accounts.
The following is a summary of the NET USER command:
C:\ NET USER /? NET USER [username [password | *] [options]] [/DOMAIN] username {password | *} /ADD [options] [/DOMAIN] username [/DELETE] [/DOMAIN]
Some commonly used options follow:
/ADD | Adds a user account. |
/DELETE | Removes a user account. |
username | The name of the account to manipulate. You can add, delete, modify, or view the account. |
password | Assigns or changes the password of a user account. |
* | Displays the password prompt. |
/DOMAIN | The action is to be performed on the primary domain controller. |
additional | options You have many additional options such as expiration date, of the account, path of the users logon profile, and many others. |
The following example shows issuing the NET USER command with no options:
C:\ NET USER User accounts for \\NIS2DEV ------------------------------------------------------------------------------ Administrator arleo_j burgos_c Guest IUSR_NIS2DEV IUSR_NISDEV johnt leung_k marty mckenna_b The command completed successfully.
Using the second form of the command shown earlier, we can add a new user to the system:
C:\ NET USER amyp * /ADD Type a password for the user: Retype the password to confirm: The request will be processed at the primary domain controller for domain DEV. The command completed successfully.
The asterisk in the NET USER command means that we want to be prompted for the password for the new user amyp.
NET VIEW - This command lists the resources being shared on a computer. You can use this command without options to display a list of computers on the domain.
The following is a summary of the NET VIEW command:
C:\ NET VIEW /? NET VIEW [\\computername | /DOMAIN[:domainname]] NET VIEW /NETWORK:NW [\\computername]
Some commonly used options follow:
//computername | Specifies the name of the computer for which you want to view shared resources. |
/DOMAIN:domainname | Specifies the name of the domain for which you wish to view shared resources. |
/NETWORK:NW | Displays NetWare servers on the network. |
The following example shows issuing the NET VIEW command with no options, producing a list of computers in the current domain:
C:\ NET VIEW Server Name Remark ------------------------------------------------------------------------------ \\NIS2DEV \\NISDEV The command completed successfully.
The following example shows issuing the NET VIEW command while specifying the DOMAIN to be viewed:
C:\ NET VIEW /DOMAIN:nisdomain Server Name Remark ------------------------------------------------------------------------------ \\HPSYSTEM1 \\KITTY \\NIS The command completed successfully.
The following example shows issuing the NET VIEW command while specifying a specific computername in the current domain to view:
C:\ NET VIEW \\nisdev Shared resources at \\hpsystem1 Share name Type Used as Comment ------------------------------------------------------------------------------ HPLaserJ5 Print HP LaserJet 5MP measure Disk net_share Disk NETLOGON Disk Logon server share The command completed successfully.
The Microsoft Windows NT Server Resource Kit (referred to as Resource Kit throughout this chapter) has on it several POSIX utilities that UNIX system administrators find useful when using Windows. The Resource Kit in general is a fantastic system administration resource. Although I will focus on only POSIX utilities in this book, the Resource Kit has in it a wealth of information. The Resource Kit is available from Microsoft Press, Redmond, WA. The POSIX utilities include such useful commands as cat, chmod, find, ls, mv, and others. The commands that are available on the Resource Kit vary somewhat from architecture to architecture. In this chapter, I focus on only the "I386" utilities and not the utilities for other architectures.
The Resource Kit has on it the file POSIX.WRI, which describes the POSIX utilities in detail. In this chapter, I'll just provide a brief overview of the utilities and examples of using some of the utilities. Most UNIX system administrators are familiar with these utilities in UNIX but may find differences in the options to these utilities when using the Resource Kit version.
I have made every effort to limit the number of "add-on" products to Windows and UNIX covered in this book. The Resource Kit, however, is so useful to Windows system administrators that not covering at least some part of it, such as the POSIX utilities, would leave a void in the discussion of Windows system administration. You can find out more information about the Resource Kit on the Microsoft Web site. You can buy it at many computer, electronic, and book stores. Be sure to buy the Resource Kit for the version of Windows you are running. There is also a Resource Kit for both the Server and Workstation versions of Windows. I used the Server Resource Kit for the POSIX commands covered in this chapter.
Both the source code and executables for the POSIX utilities are on the Resource Kit. The following is a listing of the POSIX executables for I386 on the Resource Kit CD-ROM. I used the POSIX utility ls -l to produce this listing:
F:\I386\GNU\POSIX> ls -l -rwxrwxrwx 1 Everyone Everyone 101748 Sep 6 12:39 CAT.EXE -rwxrwxrwx 1 Everyone Everyone 116188 Sep 6 12:39 CHMOD.EXE -rwxrwxrwx 1 Everyone Everyone 110920 Sep 6 12:39 CHOWN.EXE -rwxrwxrwx 1 Everyone Everyone 111208 Sep 6 12:39 CP.EXE -rwxrwxrwx 1 Everyone Everyone 173580 Sep 6 12:39 FIND.EXE -rwxrwxrwx 1 Everyone Everyone 144256 Sep 6 12:39 GREP.EXE -rwxrwxrwx 1 Everyone Everyone 90960 Sep 6 12:39 LN.EXE -rwxrwxrwx 1 Everyone Everyone 128532 Sep 6 12:39 LS.EXE -rwxrwxrwx 1 Everyone Everyone 88984 Sep 6 12:39 MKDIR.EXE -rwxrwxrwx 1 Everyone Everyone 99096 Sep 6 12:39 MV.EXE -rwxrwxrwx 1 Everyone Everyone 114564 Sep 6 12:39 RM.EXE -rwxrwxrwx 1 Everyone Everyone 85004 Sep 6 12:39 RMDIR.EXE -rwxrwxrwx 1 Everyone Everyone 362528 Sep 6 12:39 SH.EXE -rwxrwxrwx 1 Everyone Everyone 91244 Sep 6 12:39 TOUCH.EXE -rwxrwxrwx 1 Everyone Everyone 287628 Sep 6 12:39 VI.EXE -rwxrwxrwx 1 Everyone Everyone 95392 Sep 6 12:39 WC.EXE
The directory in which these utilities are located is the F: drive, which is my CD-ROM, inI386\GNU\POSIX, which is the I386 version of these utilities. The following are command summaries of the POSIX utilities. A brief description of some of the utilities as well as some of the more commonly used options to the utilities are included. In some cases, you also have an example of having run the utility. The POSIX.WRI file on the Resource Kit provides an exhaustive description of each utility.
cat - Display, combine, append, copy, or create files.
Some commonly used options follow:
-n | Line numbers are displayed, along with output lines. |
-u | Output is unbuffered, which means that it is handled character-by-character. |
-v | Prints most nonprinting characters visibly. |
The following example shows using the -n option with cat:
D:\WINNT\system> cat -n setup.inf 1 [setup] 2 help = setup.hlp 3 4 ; Place any programs here that should be run at the end of setup. 5 ; These apps will be run in order of their appearance here. 6 [run] 7 8 [dialog] 9 caption = "Windows Setup" 10 exit = "Exit Windows Setup" 11 title = "Installing Windows 3.1" 12 options = "In addition to installing Windows 3.1, you can:" 13 printwait = "Please wait while Setup configures your printer(s)..." . . . 20 [data] 21 ; Disk space required 22 ; <type of setup>= <Full install space>, <Min install space> 23 24 upd2x386full = 10000000,6144000 ; 10.0 Mb, 6.144 Mb 25 upd2x286full = 9000000,6144000 ; 9.0 Mb, 6.144 Mb 26 upd3x386full = 5500000,5000000 ; 5.5 Mb, 5.0 Mb 27 upd3x286full = 5500000,5000000 ; 5.5 Mb, 5.0 Mb 28 29 new386full = 10000000,6144000 ; 10.0 Mb, 6.144 Mb 30 new286full = 9000000,6144000 ; 9.0 Mb, 6.144 Mb 31 32 netadmin = 16000000 ; 16.0 Mb 33 netadminupd = 16000000 ; 16.0 Mb 34 upd2x386net = 300000 ; .3 Mb 35 upd3x386net = 300000 ; .3 Mb 36 upd2x286net = 300000 ; .3 Mb 37 upd3x286net = 300000 ; .3 Mb 38 new386net = 300000,300000 ; .3 Mb, .3 Mb 39 new286net = 300000,300000 ; .3 Mb, .3 Mb 40 41 42 43 ; Defaults used in setting up and names of a few files 44 startup = WIN.COM
chmod - Changes permissions of specified files using symbolic or absolute (sometimes called numeric) modes. Symbolic mode is described below.
Symbol of who is affected: | ||
u | User is affected. | |
g | Group is affected. | |
o | Other is affected. | |
a | All users are affected. | |
Operation to perform: | ||
+ | Add permission. | |
Remove permission. | ||
= | Replace permission. | |
Permission specified: | ||
r | Read permission. | |
w | Write permission. | |
x | Execute permission. | |
u | Copy user permissions. | |
g | Copy group permissions. | |
o | Copy other permissions. |
The following example uses both modes. Using absolute or numeric mode, the permissions on the file cat1.exe are changed from 666 to 777. Using symbolic mode, the execute permissions are then removed for all users:
D:\> ls -l cat1.exe -rw-rw-rw- 1 Administ Administ 71323 Feb 20 11:34 cat1.exe D:\> chmod 777 cat1.exe D:\> ls -l cat1.exe -rwxrwxrwx 1 Administ Administ 71323 Feb 20 11:34 cat1.exe D:\> chmod a-x cat1.exe D:\> ls -l cat1.exe -rw-rw-rw- 1 Administ Administ 71323 Feb 20 11:34 cat1.exe
cp - Copies files and directories.
Some commonly used options follow:
-i | Interactive copy whereby you are prompted to confirm whether or not you wish to overwrite an existing file. |
-f | Forces existing files to be overwritten by files being copied if a conflict occurs in file names. |
-p | Preserves permissions when copying. |
-R | Copies recursively, which includes subtrees. |
The following example shows using the cp command to copy cat1.exe to cat2.exe, and then a listing of all files beginning with cat is produced:
D:\> cp cat1.exe cat2.exe D:\> ls -l cat* -rw-rw-rw- 1 Administ Administ 71323 Feb 20 11:34 cat1.exe -rw-rw-rw- 1 Administ Administ 71323 Feb 20 11:47 cat2.exe
find - Recursively descends a directory structure looking for the file(s) listed.
Some commonly used options follow:
-f | Specifies a file hierarchy for find to traverse. |
-s | When symbolic links are encountered, the file referenced by the link and not the link itself will be used. |
-x | Doesn't descend into directories that have a device number different from that of the file from which the descent began. |
| Prints pathname to standard output. |
-size n | True if the file's size is n. |
grep - Searches for text and displays result.
The following example shows using grep to find the expression "shell" everywhere it appears inside the file setup.inf:
D:\> grep shell setup.inf [shell] 00000000="shell versions below 3.01",,unsupported_net 00030100="shell versions below 3.21",,novell301 00032100="shell versions 3.21 and above",,novell321 00032600="shell versions 3.26 and above",,novell326 #win.shell, 0: #win.shell, 0: [win.shell] shell.dll system.ini, Boot, "oldshell" ,"shell"
ls - Lists the contents of a directory.
Some commonly used options:
-a | List all entries. |
-c | Use time file was last modified for producing order in which files are listed. |
-d | List only the directory name, not its contents. |
-g | Include the group in the output. |
-i | Print the inode number in the first column of the report. |
-q | Nonprinting characters are represented by a "?". |
-r | Reverse the order in which files are printed. |
-s | Show the size in blocks instead of bytes. |
-t | List in order of time saved with most recent first. |
-u | Use time of last access instead of last modification for determining order in which files are printed. |
-A | Same as -a, except current and parent directories aren't listed. |
-C | Multicolumn output produced. |
-F | Directory followed by a "/", executable by an "*", symbolic link by an "@". |
-L | List file or directory to which link points. |
-R | Recursively list subdirectories. |
I include several examples on the next few pages.
D:\> ls -a Blue Monday 16.bmp Blue Monday.bmp Coffee Bean 16.bmp Coffee Bean.bmp Config Cursors FORMS FeatherTexture.bmp Fiddle Head.bmp Fonts Furry Dog 16.bmp Furry Dog.bmp Geometrix.bmp Gone Fishing.bmp Greenstone.bmp Hazy Autumn 16.bmp Help Hiking Boot.bmp Leaf Fossils 16.bmp Leather 16.bmp Maple Trails.bmp Media NETLOGON.CHG NOTEPAD.EXE Petroglyph 16.bmp Prairie Wind.bmp Profiles REGEDIT.EXE Rhododendron.bmp River Sumida.bmp Santa Fe Stucco.bmp Seaside 16.bmp Seaside.bmp ShellNew Snakeskin.bmp Soap Bubbles.bmp Solstice.bmp Swimming Pool.bmp TASKMAN.EXE TEMP Upstream 16.bmp WIN.INI WINFILE.INI WINHELP.EXE Zapotec 16.bmp Zapotec.bmp _DEFAULT.PIF black16.scr clock.avi control.ini explorer.exe inetsrv.mif inf lanma256.bmp lanmannt.bmp network.wri poledit.exe printer.wri repair setup.old setuplog.txt system system.ini system32 vmmreg32.dll welcome.exe winhlp32.exe
D:\> ls -l -rwxrwxrwx 1 Administ NETWORK 8310 Aug 9 1996 Blue Monday 16.bmp -rwxrwxrwx 1 Administ NETWORK 37940 Aug 9 1996 Blue Monday.bmp -rwxrwxrwx 1 Administ NETWORK 8312 Aug 9 1996 Coffee Bean 16.bmp -rwxrwxrwx 1 Administ NETWORK 17062 Aug 9 1996 Coffee Bean.bmp drwx---rwx 1 Administ Administ 0 Feb 10 10:39 Config drwx---rwx 1 Administ Administ 0 Feb 10 16:22 Cursors drwxrwxrwx 1 Administ NETWORK 0 Feb 10 16:23 FORMS -rwxrwxrwx 1 Administ NETWORK 16730 Aug 9 1996 FeatherTexture.bmp -rwxrwxrwx 1 Administ NETWORK 65922 Aug 9 1996 Fiddle Head.bmp drwx---rwx 1 Administ Administ 8192 Feb 10 10:39 Fonts -rwxrwxrwx 1 Administ NETWORK 18552 Aug 9 1996 Furry Dog 16.bmp -rwxrwxrwx 1 Administ NETWORK 37940 Aug 9 1996 Furry Dog.bmp -rwxrwxrwx 1 Administ NETWORK 4328 Aug 9 1996 Geometrix.bmp -rwxrwxrwx 1 Administ NETWORK 17336 Aug 9 1996 Gone Fishing.bmp -rwxrwxrwx 1 Administ NETWORK 26582 Aug 9 1996 Greenstone.bmp -rwxrwxrwx 1 Administ NETWORK 32888 Aug 9 1996 Hazy Autumn 16.bmp drwx---rwx 1 Administ Administ 0 Feb 19 15:10 Help -rwxrwxrwx 1 Administ NETWORK 37854 Aug 9 1996 Hiking Boot.bmp -rwxrwxrwx 1 Administ NETWORK 12920 Aug 9 1996 Leaf Fossils 16.bmp -rwxrwxrwx 1 Administ NETWORK 6392 Aug 9 1996 Leather 16.bmp -rwxrwxrwx 1 Administ NETWORK 26566 Aug 9 1996 Maple Trails.bmp drwx---rwx 1 Administ Administ 0 Feb 10 16:23 Media -rwxrwxrwx 1 Administ NETWORK 65536 Feb 11 10:35 NETLOGON.CHG -rwxrwxrwx 1 Administ NETWORK 45328 Aug 8 1996 NOTEPAD.EXE -rwxrwxrwx 1 Administ NETWORK 16504 Aug 9 1996 Petroglyph 16.bmp -rwxrwxrwx 1 Administ NETWORK 65954 Aug 9 1996 Prairie Wind.bmp drwxrwxrwx 1 Administ NETWORK 4096 Feb 10 16:32 Profiles -rwxrwxr-x 1 Administ NETWORK 71952 Aug 8 1996 REGEDIT.EXE -rwxrwxrwx 1 Administ NETWORK 17362 Aug 9 1996 Rhododendron.bmp -rwxrwxrwx 1 Administ NETWORK 26208 Aug 9 1996 River Sumida.bmp -rwxrwxrwx 1 Administ NETWORK 65832 Aug 9 1996 Santa Fe Stucco.bmp -rwxrwxrwx 1 Administ NETWORK 8312 Aug 9 1996 Seaside 16.bmp -rwxrwxr-x 1 Administ NETWORK 17334 Aug 9 1996 Seaside.bmp drwxrwxrwx 1 Administ NETWORK 0 Feb 10 16:22 ShellNew -rwxrwxrwx 1 Administ NETWORK 10292 Aug 9 1996 Snakeskin.bmp -rwxrwxrwx 1 Administ NETWORK 65978 Aug 9 1996 Soap Bubbles.bmp -rwxrwxr-x 1 Administ NETWORK 17334 Aug 9 1996 Solstice.bmp -rwxrwxrwx 1 Administ NETWORK 26202 Aug 9 1996 Swimming Pool.bmp -rwxrwxrwx 1 Administ NETWORK 32016 Aug 8 1996 TASKMAN.EXE drwxrwxrwx 1 Administ NETWORK 0 Feb 20 09:59 TEMP -rwxrwxrwx 1 Administ NETWORK 32888 Aug 9 1996 Upstream 16.bmp -rwxrwxrwx 1 Administ NETWORK 239 Feb 10 16:23 WIN.INI -rwxrwxr-x 1 Administ NETWORK 3 Aug 8 1996 WINFILE.INI -rwxrwxr-x 1 Administ NETWORK 256192 Aug 8 1996 WINHELP.EXE -rwxrwxrwx 1 Administ NETWORK 8312 Aug 9 1996 Zapotec 16.bmp -rwxrwxr-x 1 Administ NETWORK 9522 Aug 9 1996 Zapotec.bmp -rwxrwxr-x 1 Administ NETWORK 707 Aug 8 1996 _DEFAULT.PIF -rwx---r-x 1 Administ Administ 5328 Aug 8 1996 black16.scr -rwx---r-x 1 Administ Administ 82944 Aug 8 1996 clock.avi -rwxrwxrwx 1 Administ NETWORK 0 Feb 10 11:18 control.ini -rwx---r-x 1 Administ Administ 234256 Aug 8 1996 explorer.exe -rwxrwxrwx 1 Administ NETWORK 1628 Feb 10 11:20 inetsrv.mif drwx---rwx 1 Administ Administ 47104 Feb 10 10:56 inf -rwx---r-x 1 Administ Administ 157044 Aug 8 1996 lanma256.bmp -rwx---r-x 1 Administ Administ 157044 Aug 8 1996 lanmannt.bmp -rwx---r-x 1 Administ Administ 67328 Aug 8 1996 network.wri -rwx---r-x 1 Administ Administ 123152 Aug 8 1996 poledit.exe -rwx---r-x 1 Administ Administ 34816 Aug 8 1996 printer.wri drwx---rwx 1 Administ Administ 0 Feb 10 16:24 repair -rwxrwxrwx 1 Administ NETWORK 2499 Feb 10 16:23 setup.old -rwxrwxrwx 1 Administ NETWORK 138 Feb 10 16:22 setuplog.txt drwx---rwx 1 Administ Administ 4096 Feb 20 10:07 system -rwx---r-x 1 Administ Administ 219 Aug 8 1996 system.ini drwx---rwx 1 Administ Administ 167936 Feb 20 09:50 system32 -rwx---r-x 1 Administ Administ 24336 Aug 8 1996 vmmreg32.dll -rwx---r-x 1 Administ Administ 22288 Aug 8 1996 welcome.exe -rwx---r-x 1 Administ Administ 310032 Aug 8 1996 winhlp32.exe
D:\> ls -C Blue Monday 16.bmpGreenstone.bmpRhododendron.bmpWINFILE.INI poledit.exe Blue Monday.bmp Hazy Autumn 16.bmpRiver Sumida.bmpWINHELP.EXE printer.wri Coffee Bean 16.bmpHelp Santa Fe Stucco.bmpZapotec 16.bmprepair Coffee Bean.bmp Hiking Boot.bmp Seaside 16.bmp Zapotec.bmp setup.old Config Leaf Fossils 16.bmpSeaside.bmp _DEFAULT.PIF setuplog.txt Cursors Leather 16.bmp ShellNew black16.scr system FORMS Maple Trails.bmpSnakeskin.bmp clock.avi system.ini FeatherTexture.bmpMedia Soap Bubbles.bmpcontrol.ini system32 Fiddle Head.bmp NETLOGON.CHG Solstice.bmp explorer.exe vmmreg32.dll Fonts NOTEPAD.EXE Swimming Pool.bmpinetsrv.mif welcome.exe Furry Dog 16.bmpPetroglyph 16.bmpTASKMAN.EXE inf winhlp32.exe Furry Dog.bmp Prairie Wind.bmpTEMP lanma256.bmp Geometrix.bmp Profiles Upstream 16.bmp lanmannt.bmp Gone Fishing.bmpREGEDIT.EXE WIN.INI network.wri
mkdir - Creates specified directories.
The following is a commonly used option:
-p | Creates intermediate directories to achieve the full path. If you want to create several layers of directories down, use -p. |
mv - Renames files and directories.
Some commonly used options follow:
-i | Interactive move whereby you are prompted to confirm whether or not you wish to overwrite an existing file. |
-f | Forces existing files to be overwritten by files being moved if a conflict occurs in file names. |
rm - Removes files and directories.
Some commonly used options follow:
-d | Removes directories as well as other file types. |
-i | Interactive remove whereby you are prompted to confirm whether or not you wish to remove an existing file. |
-f | Forces files to be removed. |
-r (-R) | Recursively removes the contents of the directory and then the directory itself. |
touch - Changes the modification and/or last access times of a file, or creates a file.
Some commonly used options:
-c | Does not create a specified file if it does not exist. |
-f | Forces a touch of a file, regardless of permissions. |
The following example creates file1 with touch:
D:\> ls -l file1 ls:file1: No such file or directory D:\> touch file1 D:\> ls -l file1 -rw-rw-rw- 1 Administ Administ 0 Feb 20 11:45 file1
wc - Produces a count of words, lines, and characters.
Some commonly used options follow:
-l | Prints the number of lines in a file. |
-w | Prints the number of words in a file. |
-c | Prints the number of characters in a file. |
The first example lists the contents of a directory and pipes the output to wc. The second example provides wc information about the file system.ini.
D:\> ls CAT.EXE CHMOD.EXE CHOWN.EXE CP.EXE FIND.EXE GREP.EXE LN.EXE LS.EXE MKDIR.EXE MV.EXE RM.EXE RMDIR.EXE SH.EXE TOUCH.EXE VI.EXE WC.EXE D:\> ls | wc -wlc 16 16 132 D:\> wc -wlc system.ini 13 17 219 system.ini
There are many additional commands in Windows that can be issued at the command line. I will present some of these commands in an informal manner.
You have access to many useful networking commands on the command line in Windows. Some of the commands not covered here that you may want to look into include the following:
lpr
route
finger
rexec
ftp
telnet (opens a telnet window in the Windows environment)
hostname
lpq
tracert
rcp
rsh
tftp
You can find out more about these commands by typing the command name and /? at the command prompt, such as telnet /?. In the upcoming sections, I cover some additional commands that I often use.
arp is used to display and edit the Address Resolution Protocol (arp) cache, which maps IP addresses to physical hardware addresses. The cache has in it one or more addresses of recently accessed systems. The following example shows issuing the arp command on a Windows system at address 113 and the address of the system most recently accessed at 111, with its physical hardware address shown.
d: arp -a Interface: 159.260.112.113 on Interface 2 Internet Address Physical Address Type 159.260.112.111 08-00-09-f0-bc-40 dynamic
There are several options to the arp command that you can view by issuing the arp /? command.
ipconfig is used to display the current networking interface parameters. The following example shows issuing the ipconfig command on a Windows system at address 113 with the /all option set, which shows all information related to the networking interface:
d: ipconfig /all Windows IP Configuration Host Name . . . . . . . . . : hpsystem1 DNS Servers . . . . . . . . : Node Type . . . . . . . . . : Broadcast NetBIOS Scope ID. . . . . . : IP Routing Enabled. . . . . : No WINS Proxy Enabled. . . . . : No NetBIOS Resolution Uses DNS : No Ethernet adapter Hpddnd31: Description . . . . . . . . : HP DeskDirect 10/100 LAN Adapter Physical Address. . . . . . . : 08-00-09-D9- 9A-8A DHCP Enabled. . . . . . . . : No IP Address. . . . . . . . : 159.260.112.113 Subnet Mask . . . . . . . . : 255.255.255.0 Default Gateway . . . . . : 159.260.112.250
There are several options to the ipconfig command that you can view by issuing the ipconfig /? command.
netstat provides network protocol statistics. The following netstat example uses the -e and -s options, which show Ethernet statistics and statistics for various protocols, respectively. The Ethernet statistics associated with the -e option are under "Interface Statistics" and end with "IP Statistics":
d: netstat -e -s Interface Statistics Received Sent Bytes 3182007276 2446436 Unicast packets 11046 9604 Non-unicast packets 21827982 7932 Discards 0 0 Errors 0 1 Unknown protocols 4946670 IP Statistics Packets Received = 20489869 Received Header Errors = 133441 Received Address Errors = 28222 Datagrams Forwarded = 0 Unknown Protocols Received = 0 Received Packets Discarded = 0 Received Packets Delivered = 20328206 Output Requests = 12004 Routing Discards = 0 Discarded Output Packets = 0 Output Packet No Route = 0 Reassembly Required = 0 Reassembly Successful = 0 Reassembly Failures = 0 Datagrams Successfully Fragmented = 0 Datagrams Failing Fragmentation = 0 Fragments Created = 0 ICMP Statistics Received Sent Messages 3702 23 Errors 0 0 Destination Unreachable 4 5 Time Exceeded 0 0 Parameter Problems 0 0 Source Quenchs 0 0 Redirects 3680 0 Echos 5 13 Echo Replies 13 5 Timestamps 0 0 Timestamp Replies 0 0 Address Masks 0 0 Address Mask Replies 0 0 TCP Statistics Active Opens = 27 Passive Opens = 8 Failed Connection Attempts = 1 Reset Connections = 15 Current Connections = 2 Segments Received = 1888 Segments Sent = 1854 Segments Retransmitted = 3 UDP Statistics Datagrams Received = 607489 No Ports = 19718827 Receive Errors = 0 Datagrams Sent = 10124
There are several options to the netstat command that you can view by issuing the netstat /? command. If you wish to see the changes in the value of statistics, you can specify an interval after which the statistics will again be displayed.
ping is used to determine whether or not a host is reachable on the network. ping causes an echo request that sends packets that are returned by the destination host you specify. There are several options to the ping command you can specify. The following example uses the -n option to specify the number of times you want to send the packets, and -l specifies the length of packets for which the maximum of 8192 is used:
d: ping -n 9 -l 8192 system2 Pinging system2 [159.260.112.111] with 8192 bytes of da ta: Reply from 159.260.112.111: bytes=8192 time=20ms TTL=255 Reply from 159.260.112.111: bytes=8192 time=20ms TTL=255 Reply from 159.260.112.111: bytes=8192 time=21ms TTL=255 Reply from 159.260.112.111: bytes=8192 time=20ms TTL=255 Reply from 159.260.112.111: bytes=8192 time=10ms TTL=255 Reply from 159.260.112.111: bytes=8192 time=30ms TTL=255 Reply from 159.260.112.111: bytes=8192 time=30ms TTL=255 Reply from 159.260.112.111: bytes=8192 time=20ms TTL=255 Reply from 159.260.112.111: bytes=8192 time=20ms TTL=255
There are several additional options to the ping command that you can view by issuing the ping /? command.
You can view and change permissions of files from the command line with cacls. Figure 30-6 shows the help screen for the cacls command.
cacls is used to display and modify the access control lists of files. You can see in Figure 30-6 that you have four different types of access rights for files that were described in detail earlier. The following list shows the abbreviations for access rights that are associated with the cacls command:
N | None |
R | Read |
C | Change |
F Full | Control |
Figure 30-7 shows using both cacls and the File Permissions window to view the existing permissions for D:\WINNT\ REGEDIT.EXE. This is one of the most important files on the system that was used in an earlier chapter to view and modify Registry information on the system. This is a file that you want to carefully manage access rights to, in order to avoid any operating system mishaps.
Notice that Server Operators do indeed have Change rights to this file. You can, of course, modify the permissions on this or any file on the system. The File Permissions window and the output of the cacls command are in different formats; however, they contain the same information.
An alternative to using the graphical tools to initiate backups is to use the command line. Using the NTBACKUP command, you can initiate backups at the command line or build batch files using this command. You can combine the NTBACKUP command with the AT command to schedule backups. Provided that the SCHEDULE service is started, you can specify the time for which a job will be scheduled. Let's take a closer look at these two commands to see how they may be combined to schedule backups.
NTBACKUP - This command is used to initiate backups at the command line.
The following is a summary of the NTBACKUP command:
C:\ NTBACUKP /? NTBACKUP operation path [/a][/v][/r][/d"text"][/b][/hc:{on | off}] [/t{option}][/l"filename"][/e][/TAPE:{n}]
Some commonly used options follow:
operation | The operation to perform, such as backup. |
path | The directories you wish to back up. |
/a | Append this backup to those on the tape rather than replacing the contents of the tape with the current job. |
/b | Include the local registry in the backup. |
/d"text" | Description of the backup set is defined by the text in quotation marks. |
/e | The backup log will contain only exceptions rather than the full backup log. |
/hc:{on |off} | Specify whether or not to use hardware compression for the backup. You can use this option only if you don't use the /a option. |
/L"filename" | The file name to be used for the backup log. |
/r | Restricted access to the tape will be used. You can use this option only if you don't use the /A option. |
/t option | Specify the type of backup, such as normal, copy, incremental, differential, or daily. |
/tape:{n} | Specify the tape drive to be used if indeed the server has more than one tape drive. |
/v | Verify the operation. |
To back up the oracle directory with a normal backup, recording exceptions only in the log file, performing tape verification, and including a description of "oracle backup," you would issue the following command.
C:\ NTBACKUP backup d:/oracle /e /v /t normal /d "oracle backup"
AT - This command is used to schedule jobs.
The following is a summary of the AT command:
C:\ AT /? AT [//computername] [id] [/DELETE] | /DELETE [/YES]] AT [//computername] time [/INTERACTIVE][/EVERY:date[,...] | [/NEXT:date[,...]] "command"
Some commonly used options follow:
//computername | Computer on which the command will execute. |
id | The identification number assigned to a scheduled command. |
/DELETE | Cancel a scheduled command. You can use an id to cancel jobs associated with that id or cancel all scheduled commands. |
/YES | Reply YES as confirmation of canceled jobs. |
time | The time at which the job should be scheduled, in 24-hour format. |
/INTERACTIVE | The job will run interactively rather than in the background. |
/EVERY:date[,...] | Repeating jobs are scheduled with dates (Monday, Tuesday, and so on) or a day of the month (1-31). |
/NEXT:date[,...] | Use this option to schedule a job the next time date occurs. Specify one or more dates (Monday, Tuesday, and so on) or a day of the month (1-31). |
"command" | The command to be executed. |
We can now combine the previous NTBACKUP command with AT, to perform a scheduled backup. By placing the previous NTBACKUP command in the file backup, we can issue the following command:
C:\ AT 03:00 /every: Monday, Tuesday, Wednesday, Thursday, Friday "backup"
CONTENTS |