Merge pull request #3354 from Coffee-fan/master

synced_folders/smb: properly remove shares
This commit is contained in:
Mitchell Hashimoto 2014-04-01 21:53:44 -07:00
commit d337890f1a
1 changed files with 2 additions and 9 deletions

View File

@ -8,15 +8,8 @@ Param(
$ErrorAction = "Stop"
# See all available shares and check alert user for existing/conflicting
# share names.
$path_regexp = [System.Text.RegularExpressions.Regex]::Escape($path)
$name_regexp = [System.Text.RegularExpressions.Regex]::Escape($share_name)
$reg = "(?m)$name_regexp\s+$path_regexp\s"
$existing_share = $($(net share) -join "`n") -Match $reg
if ($existing_share) {
# Always clear the existing share name and create a new one
net share $share_name /delete /y
if (net share | Select-String $share_name) {
net share $share_name /delete /y
}
# The names of the user are language dependent!