|
@@ -25,14 +25,7 @@ new-module -name netclient-install -scriptblock {
|
|
$outpath = "$env:userprofile\Downloads\wireguard-installer.exe"
|
|
$outpath = "$env:userprofile\Downloads\wireguard-installer.exe"
|
|
Invoke-WebRequest -Uri $url -OutFile $outpath
|
|
Invoke-WebRequest -Uri $url -OutFile $outpath
|
|
$args = @("Comma","Separated","Arguments")
|
|
$args = @("Comma","Separated","Arguments")
|
|
- $procWG = Start-Process -Filepath "$env:userprofile\Downloads\wireguard-installer.exe" -ArgumentList $args
|
|
|
|
- if ($procWG -eq $null) {
|
|
|
|
- Start-Sleep -Seconds 5
|
|
|
|
- } else {
|
|
|
|
- $procWG.WaitForExit()
|
|
|
|
- }
|
|
|
|
- $procWG.WaitForExit()
|
|
|
|
- Start-Sleep -Seconds 5
|
|
|
|
|
|
+ Start-Process -Filepath "$env:userprofile\Downloads\wireguard-installer.exe" -ArgumentList $args -Wait
|
|
$software = "WireGuard";
|
|
$software = "WireGuard";
|
|
$installed = (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where { $_.DisplayName -eq $software }) -ne $null
|
|
$installed = (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where { $_.DisplayName -eq $software }) -ne $null
|
|
If(-Not $installed) {
|
|
If(-Not $installed) {
|
|
@@ -52,14 +45,11 @@ new-module -name netclient-install -scriptblock {
|
|
Write-Host "https://github.com/gravitl/netmaker/releases/download/$version/netclient.exe";
|
|
Write-Host "https://github.com/gravitl/netmaker/releases/download/$version/netclient.exe";
|
|
$url = "https://github.com/gravitl/netmaker/releases/download/$version/netclient.exe"
|
|
$url = "https://github.com/gravitl/netmaker/releases/download/$version/netclient.exe"
|
|
Invoke-WebRequest -Uri $url -OutFile $outpath
|
|
Invoke-WebRequest -Uri $url -OutFile $outpath
|
|
|
|
+ $loc = Get-Location
|
|
|
|
+ Copy-Item -Path "$env:userprofile\Downloads\netclient.exe" -Destination "$loc\netclient.exe"
|
|
}
|
|
}
|
|
$NetArgs = @("join","-t",$token)
|
|
$NetArgs = @("join","-t",$token)
|
|
- $procNC = Start-Process -Filepath $outpath -ArgumentList $NetArgs
|
|
|
|
- if ($procNC -eq $null) {
|
|
|
|
- Start-Sleep -Seconds 5
|
|
|
|
- } else {
|
|
|
|
- $procNC.WaitForExit()
|
|
|
|
- }
|
|
|
|
|
|
+ Start-Process -Filepath $outpath -ArgumentList $NetArgs -Wait
|
|
Add-MpPreference -ExclusionPath "C:\ProgramData\Netclient"
|
|
Add-MpPreference -ExclusionPath "C:\ProgramData\Netclient"
|
|
|
|
|
|
if ((Get-Command "netclient.exe" -ErrorAction SilentlyContinue) -eq $null) {
|
|
if ((Get-Command "netclient.exe" -ErrorAction SilentlyContinue) -eq $null) {
|
|
@@ -71,15 +61,7 @@ new-module -name netclient-install -scriptblock {
|
|
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
|
|
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
|
|
$env:Path += ";C:\ProgramData\Netclient\bin"
|
|
$env:Path += ";C:\ProgramData\Netclient\bin"
|
|
}
|
|
}
|
|
- '''
|
|
|
|
- Please add netclient.exe to your path to make it permanently executable from powershell:
|
|
|
|
- 1. Open "Edit environment variables for your account"
|
|
|
|
- 2. Double click on "Path"
|
|
|
|
- 3. On a new line, add the following: C:\ProgramData\Netclient\bin
|
|
|
|
- 4. Click "Ok"
|
|
|
|
- '''
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
Write-Host "'netclient' is installed."
|
|
Write-Host "'netclient' is installed."
|
|
}
|
|
}
|
|
}
|
|
}
|