Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am using Windows and despite my attempts, configuring NordVPN in WSL and attempting to run the script (which requires NordVPN to successfully connect) was just a painful experience despite the hacks and workarounds - apparently
nordvpnd
andnordvpn
are not intended to work under WSL.Because of that I needed to make it work in Windows (in order to extract a Wireguard configuration for my UDM Pro, since I didn't want to configure OVPN). This is apparently works and invoking it with
-Country
seems to produce the expected result.Different than the Linux
nordvpn
interface which would require country names such asUnited_States
to query the API properly (unless I got that wrong), the Windows utility is far more limited (such as no support fornordvpn status
) so I had to improvise.Another key difference is that it doesn't seem to support City, Country, etc. like the Linux version does. It only supports Country, ID and Server Name (like
United States #9128
). So I opted to just implement-Country
(which is "group" undernordvpn
Windows) and-Id
, in case you know exactly what server you want to connect to.Also, between the NordLynx adapter being available and there actually being connectivity to query the NordVPN API there usually is a delay so I just opted to query a popular IP identification site (WTF Is My IP - my favorite) to ensure there is connectivity before proceeding.
This is by no means exemplary work and I rarely ever do Powershell - that said, since I went through the length of actually making it work, I thought I could share this with the original project. Likewise its Linux counterpart, you'll need to ensure
nordvpn
andwireguard
and installed and available in yourPATH
before proceeding. I did not hard-code the default paths from%PROGRAMFILES%
because installations may differ.At last, the script requires Admin privileges due to
wg.exe
not being able to execute and query the interfaces otherwise. You may remove the UAC escalation from the script as long as you ensurewg.exe
can work as the unprivileged user. I didn't want to bother going through the effort so I just ensured the script isRunAs
an Administrator.