We can use net share command to create, configure and delete network shares from command line . Below you can find syntax and examples for net share command.
Create a network share from command line
The syntax for creating a share is as follows.
net share sharename=folderpath /grant:username,permissions sharename: You can assign name to the share you are going to create username : Login id of the user whom you want to share the folder with permission: Read, Change or Full
For example to share the folder E:\Docs with everyone in the domain and to give full permissions
net share Docs=E:\Documents /grant:everyone,FULL
If you are allowing multiple users to access the share, you can limit the number of users accessing the share simultaneously. This will prevent performance impact on your system. The below command will set the limit to 10 users.
net share Docs=E:\Documents /grant:everyone,FULL /users:10
Command to share with a specific user and to grant only read rights:
net share Docs=E:\Documents /grant:username,READ
Delete network share(i.e to disable sharing of the folder) from command line
net share sharename /delete
For example, to delete the share created above, the command would be as below.
net share docs /delete
Alternatively, we can use the folder physical location also to disable sharing
net share E:\Docs /delete
List the shared created on the local computer
net share
Delete the share on a remote computer
net share sharename \\remotepc /delete
the grant option does not work in windows xp.
Is there any way on the command line to CREATE a share on a remote computer?
jj
you could use winrs
Need to know how to delete a user name from the share permissions list (not delete the share)
How to list out the shared drive users. What command is there to view the users of the shared drive in command line.?
You need to use for /grant:username,READ ==>> /grant:”username,READ”, this last works fine
It might be worth saying that the default permission is to grant read access to Everyone
I want users to be able to access the shared folder on my pc which is being used as the hotspot station. However I don’t want them to access the internet, only the shared folder.
What is the command for this?
is there a cmdlet for net share?
very good
thank you
For
net share sharename=folderpath /grant:username,permissions
I can’t make any sense out of ‘username’: What is that? It is the login name of some user on some computer, but WHAT computer? It is the login name on the computer with the ‘share’, that is, the pair of the share name and the corresponding resource name? Or is it the login name of the user on the remote computer using, say, NET USE to access the share?
In your syntax diagrams please put literals in all capitals and only variables in lower case.
Norm it makes perfect sense on its own how it is… not only that but it’s explicitly explained under “Syntax”:
“net share sharename=folderpath /grant:username,permissions
sharename: You can assign name to the share you are going to create
username : Login id of the user whom you want to share the folder with
permission: Read, Change or Full”
Norm, this is basic Windows CLI:
NET USER ; gives you list of user-accounts on your computer
LUSRMGR.MSC ; GUI version