Create a Share on a Remote PC from the Command Line using WMIC in Vista/XP/2008/2003

If you're new here, you may want to subscribe to Windows Reference RSS feed Thanks for visiting!

WMIC extends WMI for operation from several command-line interfaces and through batch scripts.Windows Management Instrumentation Command-line (WMIC), which uses the power of Windows Management Instrumentation (WMI) to enable systems management from the command line, is one of those reasons.

Requirements

  • 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

wmic.PNG

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

Option Details

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.

  • Share/Bookmark

Random Posts


Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically each day to your feed reader.

No comments yet.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(required)

(required)