Windows: Create a Share on a Remote PC from the Command Line

Posted August 13, 2008 by Rob Rogers in Windows

By using the Windows Instrumentation command-line interface (WMIC), you can share an existing directory on a remote PC on your network. This can save some time when a directory needs to be shared immediately and the user does not know how to create the share. This Tech-Recipe applies to Windows XP Professional, Windows Vista, Windows Server 2003 and Windows Server 2008.


Limitations:
(a) You must have administrative rights on the remote PC.
(b) The directory that is to be shared must already exist on the remote PC.
(c) This will create a basic share, you cannot set the permissions from WMIC.

1. Open a command prompt.

2. Input WMIC to bring up the wmic prompt.

3. At the wmic prompt, execute the following command:
/node: /user:"\" /password: share call create "", "", "", "", "", 0

Where:
computer name is the name of the computer that is to share the directory.
domain is the domain the computer is in.
username is the username with administrative rights on the PC.
password is the password for the above username.
comments is the description of the share.
maximum number of connections is set to a desired level.
share name is what the share will be named.
path to folder is the local path of the folder you wish to share.

4. When prompted as to whether you wish to execute the command, type Y and press Return.

Upon execution, the directory will be shared on the remote computer.

 

About Rob Rogers

Once a prolific author here on Tech-Recipes, Rob has moved on to greener pastures.
View more articles by Rob Rogers

The Conversation

Follow the reactions below and share your own thoughts.