- Go to https://my.nordaccount.com/dashboard/nordvpn/manual-configuration/ and create an access token
- Copy token
- Use powershell to get Wireguard key
$username = "token"
$password = "<token goes here>"
$pair = "$($username):$($Password)"
$bytes = [System.Text.Encoding]::ASCII.GetBytes($pair)
$encodedCredentials = [Convert]::ToBase64String($bytes)
$url = "https://api.nordvpn.com/v1/users/services/credentials"
$headers = @{
Authorization = "Basic $encodedCredentials"
}
Invoke-RestMethod -Uri $url -Headers $headers -Method Get
id : xxxx
created_at : xxxx
updated_at : xxxx
username : xxxxx
password : xxxxx
nordlynx_private_key : xxxx
- Use powershell to get recommended server:
$server = Invoke-RestMethod -Uri "https://api.nordvpn.com/v1/servers/recommendations?&filters[servers_technologies][identifier]=wireguard_udp&limit=1"
$server | ForEach-Object {
$wireguardTech = $_.technologies | Where-Object { $_.identifier -eq 'wireguard_udp' }
if ($wireguardTech) {
# Extract metadata values
$publicKey = $wireguardTech.metadata | Where-Object { $_.name -eq 'public_key' } | Select-Object -ExpandProperty value
# Output with additional metadata columns
[pscustomobject]@{
Name = $_.name
Load = $_.load
Station = $_.Station
TechnologyID = $wireguardTech.id
TechnologyName = $wireguardTech.name
Identifier = $wireguardTech.identifier
CreatedAt = $wireguardTech.created_at
UpdatedAt = $wireguardTech.updated_at
PublicKey = $publicKey
}
}
}
Name : Germany xxx
Load : 13
Station : xx.xxx.xx.xxx
TechnologyID : 35
TechnologyName : Wireguard
Identifier : wireguard_udp
CreatedAt : 2019-02-14 14:08:43
UpdatedAt : 2019-02-14 14:08:43
PublicKey : xxxxxx
It looks like you've got the angle bracket "<" at the start and possibly the end. Your token line should look like
$password = "aslkjakjbge;jlkn4h5y0-9q3wpiub34p8h"
(I put random characters here for my example) Then, after the lines:lines you should paste the
Invoke-RestMethod -Uri $url -Headers $headers -Method Get
command and press run it by pressing enter.Copy pasted commands:

After running:

Let me know if this helps!
Edit: On second look it seems you're sending commands one at a time which might be causing powershell to get confused. If you open a text editor like notepad or notepad++ and paste everything here:
then replace the
"<token goes here>"
part as I said. Then select all the text, copy it (might need to right-click copy - I've had issues with ctrl+c working for this) go back to powershell, press escape (makes sure it's not got anything weird selected) then right-click or press ctrl+v and it should appear the same as in my screenshot. Then you can just copy paste the second set of commands directly (without using notepad) if you need that as well.