Transferred from: http://blog.sina.com.cn/s/blog_55035e9501015p05.html
----------------------------------most practical and efficient network management commands
NET
[ACCOUNTS | Computer | CONFIG | CONTINUE | FILE | GROUP | Help |
helpmsg | localgroup | PAUSE | SESSION | SHARE | START |
STATISTICS | STOP | Time | Use | USER | VIEW]
First, Net Accounts Update the user account database and modify the password and logon requests for all accounts.
Grammar
NET accounts [/forcelogoff:{minutes | no}] [/minpwlen:length] [/maxpwage:{days | unlimited}] [/minpwage:days] [/UNIQUEPW : number] [/domain]
Parameters
/forcelogoff:{minutes | no} Sets the number of minutes to wait before ending a user-server session when a user account or a valid logon time expires. The default value of no prevents users from being forced to be injected.
/minpwlen:length sets the minimum number of characters for the user account password. The number of characters ranges from 0 to 127, with a default value of 6 characters.
/maxpwage:{days | unlimited} sets the maximum number of days that a user account password is valid. The value unlimited is set to no maximum time limit. The/maxpwage command line option must be greater than/minpwage. Values range from 1 to 49,710 days (that is, the value of unlimited equals 49,710 days), and its default value is 90 days.
/minpwage:days sets the minimum number of days before a user can change a new password. The default value is 0 days, and the shortest time is not set. The range is 0 to 49,710 days.
/uniquepw:number requires the user not to repeat the same password until the specified password change number is reached. The password changes range from 0 to 24, and the default value is 5 password changes.
/domain performs operations on the primary domain controller of the current domain. Otherwise, the operation will be performed on the local computer.
Comments
The Net Logon service must be running on the computer where you want to change the account parameters. Use net accounts without parameters to display the current configuration of passwords, logon restrictions, and domain information.
You must do the following before you use Net accounts:
Create a user account. Create a user account using User Manager or net user.
Run the Net Logon service on the server that is logged on in all the verifiable domains. Net Logon starts automatically when the system starts.
When you use/forcelogoff:minutes, a warning is sent a few minutes before forcing the user to cancel from the network. If some files are open, the user is also notified. If the Minutes is less than 2, the system warns the user to immediately cancel from the network.
Example
To display the current settings, password requirements, and server roles for your server, type:
NET accounts
To set a user account password of not less than 7 characters, type:
NET Accounts/minpwlen:7
To specify that the user can re-use the password only after five password changes, type:
NET Accounts/uniquepw:5
To prevent users from changing passwords within 7 days, and forcing users to change passwords every 30 days, and to force users to log off after the logon time expires with a 5-minute warning, type:
NET Accounts/minpwage:7/maxpwage:30/forcelogoff:5
To ensure that the previous settings are valid for the domain that the computer is logged on to, type:
NET Accounts/minpwage:7/maxpwage:30/domain
Second, Net Computer Add or remove computers from the domain database.
Grammar
NET computer \\ComputerName {/add |/del}
Parameters
\\COMPUTERNAME Specifies the computers to be added or removed from the domain.
{/add |/del} Adds or removes the specified computer from the domain.
Comments
Net computer forwards all added and removed computers to the domain controller.
Example
To add a computer grizzlybear to a domain, type:
NET computer \\grizzlybear/add
Third, Net config Displays the configurable services that are running, or displays and changes settings for the Server service or Workstation service. displays a list of configurable services using the net config command without parameters.
Grammar
net config [{server|workstation}]
Parameters
When you run the Server service, server displays its settings and allows you to change the setting.
Workstation displays its settings and allows you to change this setting when you run the Workstation service.
Comments
Use the Net Config Server command to change the configurable Server service settings. The change takes effect immediately and remains permanently.
You cannot use Net config server to change all settings for the Server service. NET config server can display the following information that cannot be configured:
Server computer Name
Server comments
Server version (that is, software version number)
The server is active (that is, the network description)
The server is in a hidden state (that is,/hidden settings)
Maximum number of logged on users (the maximum number of users that can use the server share resource)
Maximum number of open files per session (that is, the maximum number of server files that a user can open in a session)
Idle session time (minimum value)
Computer name
The full computer name
User name
The workstation is active (that is, the network description)
software version (i.e. software version number)
Workstation domain
DNS name of the workstation domain
Login Domain
COM Open Time timeout (seconds)
COM send Volume (bytes)
COM Send timeout (ms)
Example
To change the configurable Server service settings, type:
NET config server
To set the number of milliseconds the computer waits before sending data to a communications device up to 500 milliseconds, type:
NET config workstation/chartime:500
To display the current configuration of the Workstation service, type:
NET config workstation
Four, Net Continue Continue by Net pause paused service.
Grammar
NET Continue Service
Parameters
Service required. Specifies the service to continue. The following table lists some of the service's values.
Value
Describe
Netlogon
Continue with the Net Logon service.
"NT lm Security Support provider"
Continue with the "NT LM Security Support provider" service.
Schedule
Continue to the Task Scheduler service.
Server
Continue with the server service.
Workstation
Continue with the "workstation" service.
Comments
To make a minor correction to a resource, please pause the service. Use the net continue command to reactivate the service or printer without canceling the user connection.
The effect of pausing and continuing a service varies with each service.
If the service name contains spaces, use quotation marks to enclose the content (for example, "service name").
Example
The following command will continue the Workstation service:
NET Continue workstation
If the server name consists of two or more words, you must enclose the server name in quotation marks for the system to recognize. For example, to continue with the NT LM Security Support Provider service, type:
NET Continue "nt LM Security Support provider"
Five, Net File displays the names of all open shared files on the server and the file lock code (if any) for each file.
The command also closes the separate shared file and removes the file lock. Displays a list of open files on the server using the net file command without parameters.
Grammar
NET file [ID [/close]]
Parameters
ID Specifies the identification number of the file.
/close closes the open file and releases the locked record. Type the command at the command prompt for the server that is sharing the file.
Comments
You can also type net files to run the command.
Use net file to view and control files that are shared on the network. Occasionally, a user may open or lock a shared file in error. At this point, other users on the network will not be able to access the locked portion of the file. You can use net File/close to delete a lock and close the file. Net file output is similar to the following form:
File
Path
User name
Lock number
0
C:\A_FILE. Txt
Marysl
0
1
C:\DATABASE
Debbiet
2
Example
To view information about a shared file, type:
NET file
To turn off the file with the identification number 1, type:
NET file 1/close
Six, Net Group Add, display, or modify global groups in a domain.
Grammar
NET group [GroupName [/comment: "Text"]] [/domain]
NET Group [GroupName {/add [/comment: ' Text '] |/delete} [/domain]]
NET group [GroupName username[...] {/add |/delete} [/domain]]
Parameters
GROUPNAME Specifies the name of the group to add, expand, or delete. Specify the group name to view only the list of users in the group.
/comment: "Text" adds a comment to a new or already existing group. Comments can contain up to 48 characters. Enclose the text in quotation marks.
/domain performs operations on the primary domain controller of the current domain. Otherwise, the operation will be performed on the local computer.
/add Add a group, or add a user name to the group. You must use this command to create an account for the users you want to add to the group.
/delete Delete the group, or remove the user from the group.
Username[...] lists one or more user names to add to or remove from a group. Separate multiple user name entries with a space.
Comments
Use the Net group command without parameters to display the server name and the name of the group on the server.
You can also type net groups.
Use the Net Group command and group users using the network in the same or similar way. When assigning power to a group, each member of the group automatically obtains these rights. In the output, net group appends an asterisk (*) to the group that contains the users and groups.
The net group output of the groups on the server is similar to the following form:
Group accounts for \\PRODUCTION
----------------------------------------------
*domain Admins *domain Users
Example
To display a list of all the groups on your local server, type:
NET Group
To add the group Exec to the local user account database, type:
NET Group Exec/add
To add the group Exec to the domain database, type:
NET Group Exec/add/domain
To add existing user accounts Stevev, RALPHR, and Jennyt to the Exec group on the local computer, type:
NET group exec Stevev RALPHR Jennyt/add
To add existing user accounts Stevev, RALPHR, and Jennyt to the Exec group in the domain database, type:
NET group exec Stevev RALPHR Jennyt/add/domain
To display the users in the exec group, type:
NET group exec
To add a comment to the exec group record, type:
NET group Exec/comment: "The executive staff."
Seven, Net Help provides a list of network commands and topics that you can get help with, or information about specific commands.
Use the net HELP command without parameters to display a list of commands and topics for which you can get assistance.
Grammar
NET HELP [Command]
Parameters
Command
/HELP Displays the correct syntax and help for the command.
Specifies the command to get help.
Example
To display Help for the net use command, type:
NET help use
or type:
NET Use/help
To view only the syntax of the net USE command, type:
Net help/?
Eight, Net helpmsg explain why the error occurred and provide information to resolve the problem.
Grammar
NET Helpmsg message#
Parameters
message# required. A 4-bit number that specifies the message to get more information.
Comments
When the network operation fails, a message similar to the following appears:
2182: The requested service has been started
Example
To obtain more information about the error message net 2182, type:
NET Helpmsg 2182
Nine, Net localgroup Add, display, or modify local groups.
Use the net localgroup command without parameters to display the names of the server and computer local groups.
Grammar
net localgroup [GroupName [/comment: "Text"]] [/domain]
net localgroup [GroupName {/add [/comment: "Text"] |/delete} [/domain]]
net localgroup [GroupName Name [...] {/add |/delete} [/domain]]
Parameters
GROUPNAME Specifies the name of the local group to add, expand, or delete. Displays a list of users or global groups in a local group using net localgroup GroupName with no other parameters.
/comment: "Text" adds a comment to a new or already existing group. A comment can contain up to 48 characters. Enclose the text in quotation marks.
/domain performs operations on the primary domain controller of the current domain. Otherwise, the operation will be performed on the local computer.
Name [...] lists one or more user or group names to add or remove from the local group.
/add Add the global group name or user name to the local group. You must establish an account for a user or global group before you use this command to add it to a local group.
/delete Remove the group name or user name from the local group.
Comments
/domain applies only to Windows XP Professional computers that are members of a domain. By default, the server computer performs operations on the primary domain controller.
Separate multiple items with spaces. The name can be a local user, a user of another domain, or a global group, but not another local group. If the user is from a different domain, add the domain name (for example, SALES\RALPHR) at the beginning of the user name.
Use the net localgroup command to group users who use computers or networks in the same or similar way. When assigning rights to a local group, each member of the local group automatically gets the same rights.
Example
To display a list of all local groups on the local server, type:
net localgroup
To add the local group Exec to the local user account database, type:
net localgroup Exec/add
To add the local group Exec to the domain user accounts database, type:
net localgroup Exec/add/domain
To add an existing user account Stevev, RALPHR (from the Sales domain), and jennyt to the Exec local group on the local computer, type:
net localgroup exec Stevev sales\ralphr jennyt/add
To add existing user accounts Stevev, RALPHR, and Jennyt to the Exec local group in the domain, type:
net localgroup exec Stevev ralphr jennyt/add/domain
To display the users in the Exec local group, type:
net localgroup exec
To add a comment to the Exec local group record, type:
net localgroup exec/comment: "The executive staff."
10. Net name Add or remove message names (that is, aliases), or display a list of names of computers that can accept messages.
Use net name without parameters to display a list of currently used names.
Grammar
NET name [name {/add |/delete}]
Parameters
Name specifies the name of the receive message. The name can have 15 characters.
/add adds a name to the computer.
/delete remove the name from the computer.
Comments
Use the net name command to specify the name of the receive message. The Messenger service must be started before using net name. Each message name must be unique across the network. The name created through net name is used only for sending messages, not for group names. Windows XP uses the following three types of names:
The name of any message (added via net name)
Computer machine name (added when starting the Workstation service)
User name (added at login if it is not used elsewhere on the network as a message name)
/add is an optional option. NET name name and net name name add have the same effect. You can use either of these commands to add a name to your computer.
The machine name of the computer cannot be deleted. You can delete a user name.
Example
To view a list of names on your computer, type:
NET Name
To add the name RSVP to your computer, type:
NET name RSVP
To remove the name RSVP from the computer, type:
NET name Rsvp/delete
11. Net Pause pauses the currently running service.
Grammar
NET Pause Service
Parameters
Service required. Specifies the service to suspend. The following table lists some of the service's values.
Value
Describe
Netlogon
Pauses the Net Logon service.
"NT lm Security Support provider"
Pauses the "NT LM Security Support provider" service.
Schedule
Pauses the Task Scheduler service.
Server
Pauses the server service.
Workstation
Pauses the "workstation" service.
Comments
On the server, use the net pause command before stopping the service to enable the user to complete the work or disconnect from the resource. Pausing a service simply puts the service in a wait state, rather than removing the software from memory. A user who is already connected to a resource can complete his or her task, but does not allow a new connection to the resource.
If you want to stop a service that affects shared resources, you should pause the service first. Use net send to send a message to stop the service. After giving the user enough time to complete the use of the resource, you can use net stop to stop the service.
To reactivate a paused service, use net continue.
You cannot pause all services. Pausing will have an impact on the service in several ways:
Pausing the Net Logon service will prevent the computer from processing logon requests. If the domain has other logon servers, the user can still log on to the network.
Pausing the server service will prevent users from establishing a new connection to the server shared resource. If there is no other logon server on the network, the user will not be able to log on to the network. Existing connections will not be affected. An administrator can establish a connection to the server even during a server pause.
Pausing the Workstation service will use the user name, password, and connection in a defined state, but will direct the request for the printer device to the printer attached to the computer, not to the printer connected to the network.
If the service name contains spaces, use quotation marks to enclose the content (for example, "service name").
Example
To pause the Server service, type:
NET Pause Server
If the server name consists of two or more words, you must enclose the server name in quotation marks. For example, to pause the NT LM Security Support Provider service, type:
NET pause "nt lm security Support provider"
12. Net Print displays information about the specified printer queue, displays information about the specified print job, or controls the specified print job.
Use net print without parameters to display command-line help for the command.
1 , displays information about the specified printer queue
Grammar
NET Print \\ComputerName\ShareName
Parameters
\\computername Required. Specifies, by name, the computer on which you want to display the print queue.
\sharename required. Specifies, by name, the shared printer queue for which you want to display information.
Comments
Net Print displays information about the print job in the shared printer queue. The following is an example report of all print jobs in a shared printer queue named Laser:
Printers at the \\PRODUCTION
Name Job number size status
---------------------------------------------------------------------------------
LASER Queue 3 Jobs * Printer activity *
USER1 84 93844 Printing
USER2 85 12555 Waiting
USER3 86 10222 Waiting
Example
To list the contents of the DotMatrix print queue on the \\PRODUCTION computer, type:
NET Print \\production\dotmatrix
2 , displays information about a specified print job, or controls the specified print job
Grammar
NET print [\\ComputerName] jobnumber [{/hold |/release |/delete}]
Parameters
\\computername Specifies, by name, the computer on which you want to control the print job. If no computer is specified, the local computer is assumed.
Jobnumber required. Specifies the number of the print job to control. The number is assigned by the computer that accepts the print job and hosts the print job. After the computer assigns a number to a print job, the number is not assigned to any other print job in any print queue hosted by the computer.
{/hold |/release |/delete} Specifies the action to be performed on the print job. The/hold parameter can defer the current print job, allowing other print jobs to skip the print job until it is republished. The/release parameter can publish a deferred print job. The/delete parameter can delete print jobs in the print queue. If you specify a print job number but do not specify an action, the information for that print job is displayed.
Comments
The following is an example of a print job report:
Job No. 35
Status Waiting
Size 3096
Comments
Owner USER2
Notify USER2
Job data type
Job parameters
Job Information
Example
To display information about job number 35 on the \\PRODUCTION computer, type:
NET Print \\production 35
To defer job number 263 on the \\PRODUCTION computer, type:
NET print \\production 263/hold
To release job number 263 on the \\PRODUCTION computer, type:
NET print \\production 263/release
Net Service Command-line reference