- You must have administrative rights on the remote PC.
- The directory that is to be shared must already exist on the remote PC.
- This will create a basic share, you cannot set the permissions from WMIC.
Procedure to follow
Open command prompt and enter wmic now you should be able to see similar to the following screen
At the wmic prompt, execute the following command
/node:<computer name> /user:”<domain>\<username>” /password:<password> share call create “”, “<comments>”, “<maximum number of connections>”, “<share name>”, “<path to folder>”, 0
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.
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.
You can use wmic to list the shared drives and folders from command line using the following command
wmic share get caption,name,path
You can also use net use command for this.