Dup Ver Goto 📝

SMB Shares in Powershell

To
25 lines, 85 words, 626 chars Page 'PowershellSmbShares' does not exist.

As easy as

New-SmbShare -Name myshare -Path c:\path\to\files

and

Get-Help Grant-SmbShareAccess
Grant-SmbShareAccess -Name Flibble -AccountName mrflibble -AccessRight Full

and to delete:

Remove-SmbShare -Name Users

and using pipes (this can be used to remove multiple shares in one line)

Get-SmbShare -Name Users | ForEach { Remove-SmbShare -Name $_.Name }

SmbMappings

Equivalent of net use

New-SmbMapping -LocalPath x: -RemotePath "\\turnip\e"
Remove-SmbMapping -LocalPath x:

note that the x: must be a drive letter, not a path.