title: SMB Shares in Powershell tags: windows powershell net smb As easy as ```powershell New-SmbShare -Name myshare -Path c:\path\to\files ``` and ```powershell Get-Help Grant-SmbShareAccess Grant-SmbShareAccess -Name Flibble -AccountName mrflibble -AccessRight Full ``` and to delete: ```powershell Remove-SmbShare -Name Users ``` and using pipes (this can be used to remove multiple shares in one line) ```powershell Get-SmbShare -Name Users | ForEach { Remove-SmbShare -Name $_.Name } ``` ## SmbMappings Equivalent of `net use` ```powershell New-SmbMapping -LocalPath x: -RemotePath "\\turnip\e" Remove-SmbMapping -LocalPath x: ``` note that the `x:` must be a drive letter, not a path.