PowerTip: Use PowerShell to Create New File Share

PowerTip: Use PowerShell to Create New File Share

  • Comments 6
  • Likes

Summary: Use Windows PowerShell to create a file share.

Hey, Scripting Guy! Question How can I use Windows PowerShell on my computer running Windows 8 to create a new file share?

Hey, Scripting Guy! Answer Open the Windows PowerShell console with Admin rights, then use the New-SmbShare function,
         and specify a file name and path:

New-SmbShare -Name fso -Path c:\fso

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • The term 'New-SmbShare' is not recognized as the name of a cmdlet... Windows 7 in a 2008 R2 Domain using UNC for the path. \\server\drive$\folder

  • Ed,

    That's because you can't use a UNC path. You are creating a share, not accessing one.

  • The term 'new-smbshare' is not recognized as the name of a cmdlet, function, script file, or operable program. Check th
    e spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:13
    + new-smbshare
    + CategoryInfo : ObjectNotFound: (new-smbshare:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


    What module is needed?

  • Cl, you're likely using the wrong OS/PS version. Amazingly if you google the cmdlet name the official technet documentation will give you the information you need: Applies To: Windows 8.1, Windows PowerShell 4.0, Windows Server 2012 R2.

  • Robin, it would be "amazingly" helpful if you just provided the answer instead of telling people to use Google. It just saves the extra step and keeps the answer in one place.

    Alas "Google" told me that I cannot use New-SmbShare on Windows Server 2008 r2 or Windows 7.

    There was a link to this article instead: http://serverfault.com/questions/581585/create-network-shared-folder-using-powershell-on-windows-7

    Although it did seem slightly incomplete.