Windows 10: Creating a shared directory on the network using the command prompt

Discus and support Creating a shared directory on the network using the command prompt in Windows 10 Network and Sharing to solve the problem; Hi I have Windows 10 v1703 Enterprise 64 bit with the Microsoft accounts. Wanting to create a shared directory on the network using the command... Discussion in 'Windows 10 Network and Sharing' started by balubeto, Jul 14, 2017.

  1. balubeto Win User

    Creating a shared directory on the network using the command prompt


    Hi

    I have Windows 10 v1703 Enterprise 64 bit with the Microsoft accounts.

    Wanting to create a shared directory on the network using the command prompt, in an administrative account I ran the Command Prompt (as administrator) and I run the following commands:

    Code: md C:\Users\Public\Documents\WIM_file net share WIM_file="C:\Users\Public\Documents\WIM_file" /grant:" (xxx@yyy.zz)",read /grant:" (xxx@yyy.zz)",write /cache:none System error 1332. No mapping between account names and security IDs (SIDs) has been made.[/quote] Where am I wrong?

    Thanks

    Bye

    :)
     
    balubeto, Jul 14, 2017
    #1

  2. Hosted network support

    After creating in Command Prompt does it gets listed in Network and sharing center?
     
    Sumit Dhiman2, Jul 14, 2017
    #2
  3. Connect to a Wi-Fi network using Command Prompt

    If you have a SSID with space, please use "" to specify the name i.e. if your SSID is Home WiFi, type netsh wlan connect "Home WiFi" or netsh wlan connect name="Home WiFi"
     
    SatyajitMishra, Jul 14, 2017
    #3
  4. Kari Win User

    Creating a shared directory on the network using the command prompt

    Creating a shared directory on the network using the command prompt [​IMG]
    Warning Please edit you post and remove the email address. It is never a good idea to post your email or street address, phone number or other personal informatiom. It can (and often will!) be misused and lead to serious complications.

    Regardless if you are signing in to Windows using a local account, Microsoft account or workplace Azure AD account, in networking your username is your user profile name, not the email address.

    For instance, I sign in to Windows with a Microsoft account @An_Imaginary_Email_Provider.com, but in all networking purposes my user name to access shares on this machine is just , or using the long form \\ComputerName\.

    Second, you don't need to grant read and write access separately. Granting full access rights takes care of both.

    In screenshot I created a folder on my H: drive, naming it ShareDemo, then shared it granting myself full access:


    Creating a shared directory on the network using the command prompt [​IMG]


    Checking the folder properties I can see everything is as expected, I will have full access rights to this shared folder:


    Creating a shared directory on the network using the command prompt [​IMG]
     
  5. lx07 Win User
    Problem 1
    You have entered email address in this format "Your name (YourName@hotmail.com)". Doing this, putting in an email address that is not linked to an account on your system or entering an account that doesn't exist on your system will give System error 1332.

    If you want to use an email address then it muct be in YourName@hotmail.com format and it must be linked to an account on your system - it is mapped automatically to PC_NAME\UserName format. Code: C:\WINDOWS\system32>net share Downloads="C:\Users\Hali\Downloads" /grant:my.email@hotmail.com,full Downloads2 was shared successfully. C:\WINDOWS\system32>net share downloads Share name Downloads Path C:\Users\Hali\Downloads Remark Maximum users No limit Users Caching Manual caching of documents Permission X201\Hali, FULL The command completed successfully.[/quote] Problem 2
    In fact you can't - write is not an option. The options you have for net share are READ, CHANGE and FULL.
    Code: C:\WINDOWS\system32>net share /? The syntax of this command is: NET SHARE sharename sharename=driveCreating a shared directory on the network using the command prompt :path [/GRANT:user,[READ | CHANGE | FULL]][/quote] If you want read and write you likely want the CHANGE permission (CHANGE allows modify, create, delete, FULL allows user to change permissions also).


    In summary you need to fix your account name/email address and drop trying to grant write.

    Replace thisnet share WIM_file="C:\Users\Public\Documents\WIM_file" /grant:"Balubeto Balubeto (xxxxxxx@hotmail.com)",read /grant:"Balubeto Balubeto (xxxxxxxx@hotmail.com)",write /cache:none
    with
    net share WIM_file="C:\Users\Public\Documents\WIM_file" /grant:xxxxxxx@hotmail.com,change /cache:none


    Setting permission on share and NTFS means you have duplication and you also can't change the permissions on the share. To add another user for example you would have to delete it and add it again.
    A little something about Share vs NTFS permissions

    A better option is to grant everyone full authority and then deal with access using NTFS permissions - so set the share
    net share WIM_file="C:\Users\Public\Documents\WIM_file" /grant:everyone,full /cache:none
     
  6. Kari Win User
     
  7. balubeto Win User
    I tried the net share WIM_file="C:\Users\Public\Documents\WIM_file" /grant:xxx@yyy.zz,change /cache:none command and it works.

    Now, from the Command Prompt, how do I delete a user (with its share permissions) from a shared directory?

    Thanks

    Bye
     
    balubeto, Jul 15, 2017
    #7
  8. lx07 Win User

    Creating a shared directory on the network using the command prompt

    By default you can't. You have to delete the share and reado it or you get the error "the name has already been shared". Code: C:\>net share Downloads2="C:\Users\Hali\Downloads" /grant:administrators,full /grant:users,read Downloads2 was shared successfully. C:\>net share Downloads2 Share name Downloads2 Path C:\Users\Hali\Downloads Remark Maximum users No limit Users Caching Manual caching of documents Permission BUILTIN\Administrators, FULL BUILTIN\Users, READ The command completed successfully. C:\>net share Downloads2="C:\Users\Hali\Downloads" /grant:everyone,full The name has already been shared. More help is available by typing NET HELPMSG 2118. C:\WINDOWS\system32>net share Downloads2 /delete Downloads2 was deleted successfully. C:\>net share Downloads2="C:\Users\Hali\Downloads" /grant:administrators,full /grant:users,read /grant:everyone,full Downloads2 was shared successfully. C:\>net share Downloads2 Share name Downloads2 Path C:\Users\Hali\Downloads Remark Maximum users No limit Users Caching Manual caching of documents Permission BUILTIN\Administrators, FULL BUILTIN\Users, READ Everyone, FULL The command completed successfully.[/quote]
    You could download SetACL.exe and use that as described here.

    For example to add then remove "Everyone":

    Code: C:\>SetACL.exe -on "Downloads2" -ot shr -actn ace -ace "n:everyone;p:change" Processing ACL of: <Downloads2> SetACL finished successfully. C:\>net share downloads2 Share name Downloads2 Path C:\Users\Hali\Downloads Remark Maximum users No limit Users Caching Manual caching of documents Permission BUILTIN\Administrators, FULL BUILTIN\Users, READ Everyone, CHANGE The command completed successfully. C:\>SetACL.exe -on "Downloads2" -ot shr -actn trustee -trst "n1:Everyone;ta:remtrst" Processing ACL of: <Downloads2> SetACL finished successfully. C:\>net share downloads2 Share name Downloads2 Path C:\Users\Hali\Downloads Remark Maximum users No limit Users Caching Manual caching of documents Permission BUILTIN\Administrators, FULL BUILTIN\Users, READ The command completed successfully.[/quote]

    The syntax of SetACL command is not particularly intuitive but is described well in their documentation here: SetACL Command Line-Version (SetACL.exe) - Syntax and Description if you want to play with share permissions (I don't *Wink )

    This is another reason to set the share to everyone,full and control access through NTFS - you are just making an administrative headache for no benefit (that I can see) as access is granted on the most restrictive of NTFS and share permission anyway.
     
    lx07, Apr 5, 2018
    #8
Thema:

Creating a shared directory on the network using the command prompt

Loading...
  1. Creating a shared directory on the network using the command prompt - Similar Threads - Creating shared directory

  2. Command prompt lost many useful commands

    in Windows 10 Software and Apps
    Command prompt lost many useful commands: Hi thereCMD on my Windows 10 PC has lost many useful commands.If I type dir it lists files in the current directory. It also responds correctly to cd, copy, eraseBut most other commands are lost. For example, help gives this response:'help' is not recognized as an internal or...
  3. Command prompt lost many useful commands

    in Windows 10 Installation and Upgrade
    Command prompt lost many useful commands: Hi thereCMD on my Windows 10 PC has lost many useful commands.If I type dir it lists files in the current directory. It also responds correctly to cd, copy, eraseBut most other commands are lost. For example, help gives this response:'help' is not recognized as an internal or...
  4. Unable to access directories via Command Prompt

    in Windows 10 BSOD Crashes and Debugging
    Unable to access directories via Command Prompt: I need to use Command Prompt, but when I add the directory, I get this error: 'C:\Program' is not recognized as an internal or external command, operable program or batch file. I've made sure C:\Windows\32 is included in the Environment Variables under "Path", but I can't...
  5. Using command prompt to backup

    in Windows 10 BSOD Crashes and Debugging
    Using command prompt to backup: Hello My computer has crashed and is not loading past the blue screen but it does give me advanced options to go onto the command prompt. I am wondering if there is a way from command prompt, to back up all my files on my PC hard drive to my one drive also on the pc or if...
  6. Cant use Command Prompt

    in Windows 10 Installation and Upgrade
    Cant use Command Prompt: So as you can see in the SECOND photo below those are my Enviromental Variables. I cant use my Command Prompt for anything not even to verify app versions. For some odd reason its configured to a 32 bit system and a OpenSSh. I dont know what it means and I suspect its the...
  7. Search using the Command Prompt

    in Windows 10 Support
    Search using the Command Prompt: Hi - I need a bit of help but it cannot be too technical as I don't understand half of what I read in these threads*Confused My computer will not boot into Windows 10 (10.0.18302.356) but it does get so far as a Recovery Screen which tells me that a critical system driver is...
  8. Create a File List at a Command Prompt

    in Windows 10 BSOD Crashes and Debugging
    Create a File List at a Command Prompt: From the directions on the support page: https://support.microsoft.com/en-us/help/196158/how-to-create-a-text-file-list-of-the-contents-of-a-folder dir > filename.txt doesn't work for me in Windows 10. I get the error "There is not enough space on this disk." Even though...
  9. Change command prompt default directory

    in Windows 10 Customization
    Change command prompt default directory: How do I change the command prompt's default directory in Windows 10? I see instructions in Sevenforums to do this in Windows 7 but not in Windows 10. Will the Windows 7 instructions work in Windows 10? 54910
  10. Network Share - Prompt for credentials

    in Windows 10 Network and Sharing
    Network Share - Prompt for credentials: Hi, I have recently gotten a Windows 10 machine. In my network I have Windows 8.1 machine with shared folders, and several other Windows 8/7 laptops with access. All those computers (including Xbox One) can see my desktop share computer and folders + access to the content...