mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-27 14:37:27 +08:00
windows netclient fix
This commit is contained in:
parent
10115e9882
commit
20a939b188
2 changed files with 5 additions and 4 deletions
|
|
@ -188,10 +188,9 @@ func InitWireguard(node *models.Node, privkey string, peers []wgtypes.PeerConfig
|
|||
}
|
||||
if ncutils.IsWindows() {
|
||||
wgConfPath := ncutils.GetWGPathSpecific() + ifacename + ".conf"
|
||||
ncutils.PrintLog("error writing wg conf file to "+confPath+": "+err.Error(), 1)
|
||||
err = ioutil.WriteFile(wgConfPath, []byte(newConf), 0644)
|
||||
if err != nil {
|
||||
ncutils.PrintLog("error writing wg conf file to "+confPath+": "+err.Error(), 1)
|
||||
ncutils.PrintLog("error writing wg conf file to "+wgConfPath+": "+err.Error(), 1)
|
||||
return err
|
||||
}
|
||||
confPath = wgConfPath
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ new-module -name netclient-install -scriptblock {
|
|||
$outpath = "$env:userprofile\Downloads\wireguard-installer.exe"
|
||||
Invoke-WebRequest -Uri $url -OutFile $outpath
|
||||
$args = @("Comma","Separated","Arguments")
|
||||
Start-Process -Filepath "$env:userprofile\Downloads\wireguard-installer.exe" -ArgumentList $args
|
||||
$procWG = Start-Process -Filepath "$env:userprofile\Downloads\wireguard-installer.exe" -ArgumentList $args
|
||||
$procWG.WaitForExit()
|
||||
Start-Sleep -Seconds 5
|
||||
$software = "WireGuard";
|
||||
$installed = (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where { $_.DisplayName -eq $software }) -ne $null
|
||||
|
|
@ -46,7 +47,8 @@ new-module -name netclient-install -scriptblock {
|
|||
Invoke-WebRequest -Uri $url -OutFile $outpath
|
||||
}
|
||||
$NetArgs = @("join","-t",$token)
|
||||
Start-Process -Filepath $outpath -ArgumentList $NetArgs
|
||||
$procNC = Start-Process -Filepath $outpath -ArgumentList $NetArgs
|
||||
$procNC.WaitForExit()
|
||||
Add-MpPreference -ExclusionPath "C:\ProgramData\Netclient"
|
||||
|
||||
if ((Get-Command "netclient.exe" -ErrorAction SilentlyContinue) -eq $null) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue