Professional Windows Server 1002003 Security A Technical Reference [Electronic resources]

Roberta Bragg

نسخه متنی -صفحه : 415/ 339
نمايش فراداده

net share

Manages shared resources.

Syntax

net share sharename
net share sharename=drive:path [/users:number | /unlimited] 
[/remark:"text"] [/cache:Manual | Automatic | No]
net share sharename [/users:number | /unlimited] [/remark:"text"] 
[/cache:Manual | Automatic | No]
net share {sharename | devicename | drive:path} /delete

Options

None

A list of information about all shares on the server

sharename

The name of the share (may differ from actual name of folder or printer shared)

drive:path

Absolute path of a folder to share or unshare

/users:number

Maximum number of users who can simultaneously connect to the share

/unlimited

No limit to number of users who can simultaneously connect to the share

/remark:"text"

Description of share

/cache

Undocumented option for configuring share caching for offline folders

/delete

Used to unshare (stop sharing) the share

Examples

List all shared resources on the local machine:

net share
Share name   Resource                     Remark
---------------------------------------------------------
C$           C:\                          Default share
IPC$                                      Remote IPC
print$       C:\WINDOWS\System32\         Printer Drivers
spool\drivers
H$           H:\                          Default share
ADMIN$       C:\WINDOWS                   Remote Admin
G$           G:\                          Default share
F$           F:\                          Default share
E$           E:\                          Default share
CertConfig   C:\CAConfig                   Certificate Services configuration
CertEnroll   C:\WINDOWS\System32\         Certificate Services share
CertSrv\CertEnroll
NETLOGON     C:\WINDOWS\ sysvol \sysvol\  Logon server share
mtitcanada.com\SCRIPTS
pub          G:\pub
SYSVOL       C:\WINDOWS\sysvol\sysvol     Logon server share
Tool         E:\Tool
BROTHER      \\SELKIRK\BROTHER            Spooled       \\SELKIRK\BROTHER
HPLaserJ     LPT1:                        Spooled  HP   LaserJet 5L
The command completed successfully.

View details of PUB share:

net share pub
Share name                   pub
Path                         G:\pub
Remark
Maximum users                No limit
Users
The command completed successfully.

Unshare the PUB share:

net share pub /delete
Users have open files on pub.  Continuing the 
operation will force the files closed.
Do you want to continue this operation? (Y/N) [N]: y
pub was deleted successfully.

Reshare PUB:

net share pub=G:\pub
The command completed successfully.

Notes

  • Enclose the absolute path in quotes if it contains embedded spaces.

  • If you delete a shared folder using net share /delete, the share may still be visible in My Computer and Windows Explorer even if you reboot. The workaround is to press F5 to flush the cached information.

  • The /cache option can configure the share-caching mode to be used when offline folders are implemented (see

    Files and Folders in Chapter 4). For a full description of this option, see Knowledge Base article 214738 on Microsoft TechNet.

See Also

Files and Folders , net file, net session, net use, net view,

Shared Folders