18
Dec/09
2

Create a Share Remotely using the WMI Command-Line Tool

To manage Windows remotely through the command line interface, you can can use wmic (comes with windows).
Here’s the syntax to create a Windows File Share on a remote machine using a single line of code. With Windows NT some might remember rmtshare.exe which did the same thing, but crashes with more recent versions of Windows.

wmic /node:%REMOTESERVER% share call create “”, “%DESCRIPTION%”,”%MAX CONNECTIONS (LEAVE BLANK FOR UNLTD)%”, “%SHARENAME%”,”" , “%LOCAL PATH TO FOLDER%”, 0

Example:
wmic /node:SERVER1 share call create "", "User Homedrive for microtom","", "microtom$","" , "D:\Shares\Users\microtom", 0

You can find more information on WMIC here:
http://technet.microsoft.com/en-us/library/bb742610.aspx

Print This Post
(2 votes, average: 4.50 out of 5)
Loading ... Loading ...
1,106 views