bat script to share a folder
I'm trying to share a folder using a bat script
I'm trying something like this, but it doesn't work
NET SHARE test=P:<folderLocation> /GRANT:domain\username,FULL
it's giving me system error 5 - access is denied even tho I'm the domain admin :S
June 29th, 2012 10:55am
Hello,
Create a batch file with the below data and run it with admin rights, then share will be created with selected permission in selected path.
@echo off
E: ==>select drive(I used E drive), wher you want create a folder
mkdir test1 ==>you need to make a folder before to share and name it (ex:test1)
net share test1=E:\test1/GRANT:domain\username,full ==>share the folder using
net share command
Pause ==> final step
Thank you and feel free to write here again if you need any other help.
Regards, Ravikumar P
Free Windows Admin Tool Kit Click here and download it now
June 29th, 2012 11:27am
thanks, I'm trying to share a folder which is on a serves hdd so I need to access it by going to \\srv-001\e$\folder - and it's giving me an error -
System error 123 has occurred.
The filename, directory name, or volume label syntax is incorrect.
June 29th, 2012 11:46am
try with rmtshare if you want command line,
or use a remote manage and click on the shares if you want to do it by the gui
Free Windows Admin Tool Kit Click here and download it now
June 29th, 2012 3:01pm
If youre looking to share the folder named folder from the e drive on server srv-001, use server manager to connect to srv-001 and share from there.
June 29th, 2012 4:49pm
I suggest you ask this question in the
Microsoft Script Forum for further discussion.
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Mohammed Imtiyaz Ali
Free Windows Admin Tool Kit Click here and download it now
June 30th, 2012 12:54am
thanks, I'm trying to share a folder which is on a serves hdd so I need to access it by going to \\srv-001\e$\folder - and it's giving me an error -
System error 123 has occurred.
The filename, directory name, or volume label syntax is incorrect.
Are you creating a share in remote machine or in location machine.?
If you use local machine just choose a path E:\folder instead of UNC path \\srv-001\e$\folder.
Regards, Ravikumar P
June 30th, 2012 12:11pm
Hi,
If you want to create a share folder via script, I suggest we tried to refer to the following articles.
Create a Shared Folder and Assign Share Permissions
http://gallery.technet.microsoft.com/ScriptCenter/6309d93b-fcc3-4586-b102-a71415244712/
Create a Shared Folder
http://gallery.technet.microsoft.com/scriptcenter/d654b1ff-1091-4173-affd-67d5d09b0923
If you have some trouble in editing the script, I suggest we could ask in the script forum.
The Official Scripting Guys Forum!
http://social.technet.microsoft.com/Forums/en/ITCG/threads/
Regards,
Andy
Free Windows Admin Tool Kit Click here and download it now
July 1st, 2012 11:24pm
thanks, I'm trying to share a folder which is on a serves hdd so I need to access it by going to \\srv-001\e$\folder - and it's giving me an error -
System error 123 has occurred.
The filename, directory name, or volume label syntax is incorrect.
Are you creating a share in remote machine or in location machine.?
If you use local machine just choose a path E:\folder instead of UNC path \\srv-001\e$\folder.
Regards, Ravikumar P
the folder is on a remote machine
July 2nd, 2012 4:11am
If youre looking to share the folder named folder from the e drive on server srv-001, use server manager to connect to srv-001 and share from there.
I need this script to run as a longon script - I can't do it manually for hundreds of users hence why I'm looking at a script
Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2012 4:12am
By using net share command, we can't create share in remote machine rather we can go for another commands/scripts.
Another useful link for WMI script. http://blogs.technet.com/b/heyscriptingguy/archive/2005/01/07/how-can-i-share-a-folder-on-a-remote-computer.aspx
More about WMI command:http://technet.microsoft.com/en-us/library/bb742610.aspx
Regards, Ravikumar P
July 2nd, 2012 9:28am


