The Net Print command
This command displays information about print jobs and shared print queues. To display information about a print queue, use this syntax:
net print \\computername\sharename
To display information about a specific print job or to change the status of a print job, use this syntax:
net print [\\computername] job# [/HOLD | /RELEASE | /DELETE]
The following paragraphs describe the parameters of the Net Print command:
- \\computername: The name of the computer sharing the printer.
- Sharename: The name of the shared printer.
- job#: The identification number for the print job.
- Hold: Prevents a job in a queue from printing. The job remains in the queue but is not printed until released.
- Release: Releases a job that was held.
- Delete: Removes a job from the print queue.
To display the status of the print queue for a printer named LASER1 on a computer named PSERVER, use this command:
C:\>net print \\PSERVER\LASER1 Printers at \\PSERVER Name Job # Size Status --------------------------------------------------------- LASER1Queue 3 jobs *Printer Active* Ward 54 43546 Printing Wally 55 13565 Waiting Beaver 56 18321 Waiting
Now suppose that you happen to be user Beaver and you want to crowd ahead of Wally's print job. All you have to do is issue this command:
C:\>net print \\PSERVER 55 /hold
The Net Send command
This command lets you send messages to other users on the network. The message pops up, interrupting whatever the user is doing. Use this command sparingly, or you'll lose friends quickly. Here's the syntax:
net send {name | * | /domain[:name] | /users} message
Here's what each of the parameters do:
- Name: Provides the name of the user or computer to whom you want to send the message. (This can also be an alias created by the Net Name command.) If the name includes spaces, enclose it in quotes.
- *: Sends the message to all computers in the domain or workgroup.
- Domain: Sends the message to everyone in the computer's domain or workgroup. If you specify a domain name, the message is sent to all users in the specified domain or workgroup.
- Users: Sends the message to all users who are currently connected to the server.
- Message: The message to be sent. Interestingly, you don't have to enclose the message in quotes even if it contains spaces.
To send the message "I'm shutting down the server in 10 minutes" to everyone on the network, use this command:
To send the message "How about lunch?" to a user named Pooh, use this command:
C:\>net send pooh How about lunch?
The Net Session command
This command lets you view current server connections and kick users off, if you feel inclined. Here's the syntax:
net session [\\ComputerName] [/delete]
Here's what the parameters do:
- ComputerName: Indicates which computer's session you want to view or disconnect. If you omit this parameter, all sessions are listed.
- Delete: Disconnects the computer's session. Any open files are immediately closed. If you use this parameter without specifying a computer name, all computers currently connected to the server are disconnected.
This is an obviously dangerous command. If you disconnect users while they're updating files or before they have a chance to save their work, they will be hopping mad.
To find out who is connected to a computer, use this command:
C:\>net session Computer User name Client type Opens Idle time ------------------------------------------------------------ \\DEN Ward Windows XP 1 00:00:4 \\BEDROOM Administrator Windows 2008 0 02:15:17
The Net Share command
This command lets you manage shared resources. To display information about all shares or a specific share, use this syntax:
net share [ShareName]
To create a new share, use this syntax:
net share ShareName=path [{/users:number|/unlimited}] [/remark:"text"] [/cache: {manual|automatic|no}] C:\>net send * I'm shutting down the server in 10 minutes
To change the properties of an existing share, use this syntax:
net share ShareName [{/users:number|unlimited}] [/remark:"text"] [/cache: {manual|automatic|no}]
To delete an existing share, use this syntax:
net share {ShareName|drive:path} /delete
Here's what each of the parameters do:
- ShareName: Specifies the share name. Use this parameter by itself to display information about the share.
- Path: Specifies the path to the folder to be shared. The path should include a drive letter. If the path includes spaces, enclose it in quotation marks.
- Users: Specifies how many users can access the share concurrently.
- Unlimited: Specifies that an unlimited number of users can access the share concurrently.
- Remark: Creates a descriptive comment for the share. The comment should be enclosed in quotation marks.
- Cache: Specifies the caching option for the share.
- Delete: Stops sharing the folder.
If you use Net Share without any parameters, all the current shares are listed, as shown in this example:
C:\>net share Sharename Resource Remark ------------------------------------------------------ ADMIN$ C:\WINNT Remote Admin C$ C:\ Default Share print$ C:\WINNT\SYSTEM\SPOOL IPC$ Remote IPC LASER LPT1 Spooled Laser printer
The following example creates a share named Docs:
C:\>net share Docs=C:\SharedDocs /remark:"Shared documents"