Skip to content

Commit

Permalink
Re-create SMB share every time
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Finkelshteyn committed Apr 22, 2019
1 parent 5a80129 commit 569697c
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions scripts/docker-appveyor.psm1
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
function Switch-DockerLinux
{
& "$env:ProgramFiles\Docker\Docker\DockerCli.exe" -SwitchLinuxEngine
$dshare = (Get-SmbShare -Name D -ErrorAction SilentlyContinue)
if (-not $dshare) {
$deUsername = 'DockerExchange'
$dePsw = "ABC" + [guid]::NewGuid().ToString() + "!"
$secDePsw = ConvertTo-SecureString $dePsw -AsPlainText -Force
Get-LocalUser -Name $deUsername | Set-LocalUser -Password $secDePsw
& $env:ProgramFiles\Docker\Docker\DockerCli.exe -Start --testftw!928374kasljf039 >$null 2>&1
& $env:ProgramFiles\Docker\Docker\DockerCli.exe -Mount=D -Username="$env:computername\$deUsername" -Password="$dePsw" --testftw!928374kasljf039 >$null 2>&1
Disable-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Inbound
}
Remove-SmbShare -Name D -ErrorAction SilentlyContinue -Force
$deUsername = 'DockerExchange'
$dePsw = "ABC" + [guid]::NewGuid().ToString() + "!"
$secDePsw = ConvertTo-SecureString $dePsw -AsPlainText -Force
Get-LocalUser -Name $deUsername | Set-LocalUser -Password $secDePsw
& $env:ProgramFiles\Docker\Docker\DockerCli.exe -Start --testftw!928374kasljf039 >$null 2>&1
& $env:ProgramFiles\Docker\Docker\DockerCli.exe -Mount=D -Username="$env:computername\$deUsername" -Password="$dePsw" --testftw!928374kasljf039 >$null 2>&1
Disable-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Inbound
}

function Switch-DockerWindows
Expand Down

0 comments on commit 569697c

Please sign in to comment.