CreatinG windows share remotely from a command line

Associate
Joined
22 Oct 2002
Posts
958
Location
Colchester
Hello,

Trying to create a batch file to create share on a server remotely to well make life a little simpler...any Idea how???

Can do the permissions with setacl.exe , just need to create the folders and shares remotely...

Help


GJUK
 
you can do this using the WMI Console assuming you have administrative rights on the remote box.

Open a command prompt and type WMIC

Then something like this:

/node:<computername> /user:"<domain>\<username>" /password:<password> share call create "", "<comments>", "<maximum number of connections>", "<share name>", "<path to folder>", 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

If you're good it might ask you to confirm your actions, just press Y

If you want to batch all of that I would recommend talking to WMI via a VBScript
 
C:\>wmic /node:"myserver" /user:"myDomain\administrator" /password:something share call create "", "Users home directories","5","USERS", "E:\USERS", 0
Executing (Win32_Share)->Create()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
ReturnValue = 21;
};

I am typing it wrong??.......yes I am having a bad day..lol
 
Back
Top Bottom