-
-
Save rescenic/8bf62bc8e7956b2e15224da7176a2d83 to your computer and use it in GitHub Desktop.
Wireguard "Access Denied" fix on Windows 10+
This file contains hidden or 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
| $rule = New-Object System.Security.AccessControl.RegistryAccessRule( | |
| "NT AUTHORITY\NETWORK SERVICE", # IdentityReference | |
| [System.Security.AccessControl.RegistryRights]::FullControl, # RegistryRights | |
| [System.Security.AccessControl.InheritanceFlags]::ContainerInherit, # InheritanceFlags | |
| [System.Security.AccessControl.PropagationFlags]::None, # PropagationFlags | |
| [System.Security.AccessControl.AccessControlType]::Allow # AccessControlType | |
| ) | |
| $registry_keys = "Dhcp", "Tcpip", "Tcpip6", "TCPIPTUNNEL", "TCPIP6TUNNEL" | |
| $registry_folder = "HKLM:\SYSTEM\CurrentControlSet\Services\{registry_key}" | |
| foreach ($registry_key in $registry_keys) | |
| { | |
| $full_registry_key = $registry_folder.Replace("{registry_key}", $registry_key) | |
| $acl = Get-Acl $full_registry_key | |
| $acl.AddAccessRule($rule) | |
| Set-Acl -Path $full_registry_key -AclObject $acl | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment