This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2021 Max Schulze. All Rights Reserved. | |
# near-literal Translation of the linux version by Jason A. Donenfeld | |
# to decrypt the dpapi Credentials, you have to be the same user as the wireguard tunnel service, i.e. "nt authority\system", check with "whoami" | |
# this script might be called by task scheduler as | |
# powershell -NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -Command "Get-ChildItem -File 'c:\Program Files\wireguard\data\configurations\*.dpapi' | foreach {& C:\<path to script>\wireguard_reresolve-dns.ps1 $_.FullName}" | |
# if you want to try it in cmd, remember to elevate the user, i.e. with psexec from sysutils | |
# psexec -s -i powershell -NoPr... | |
Set-StrictMode -Version 3 |