2

After using Nord VPN (over a year's time) and noticing that it created nearly 700 variations of Network Profiles, I wanted to purge them from my Windows system.

An EXAMPLE of Registry Keys to target for deletion:

HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\{00BE6D28-2312-49C7-9A54-2184ACA58B6B}

And its counterpart:

HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged\010103000F0000F0000200000F0000F01639F7681A17C9A33AB424EA8A319DBD328F2CE4FA95316F75AACEBE62560603

How might this be accomplished using PowerShell?

2
  • 1
    Shrug, there is not question in this question. Commented Jun 27 at 5:07
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Jun 27 at 5:17

1 Answer 1

1

Using PowerShell, I was able to accomplish the goal:

# 
# Delete Network Profiles from the Windows Registry based on specific value in their Network Description
# 
# Written 2025-06-27 by Paul DeBrino
# Syntax consolidations kindly contributed by Santiago Squarzon
# 
# Shared on StackOverflow:
# https://stackoverflow.com/questions/79681393/use-powershell-to-iterate-windows-registry-for-a-network-profile-name-and-option
# 
# EXAMPLE of Registry Keys to target for deletion -- Both were installed by Nord VPN (for a total of 691 on my Windows PC):
# "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged\010103000F0000F0000200000F0000F01639F7681A17C9A33AB424EA8A319DBD328F2CE4FA95316F75AACEBE62560603"
# "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\{00BE6D28-2312-49C7-9A54-2184ACA58B6B}"

# -------------------\
[string] $NetworkDescLIKE = 'Nord'
# If WhatIf is 1 then Confirm is ignored
[bool] $EngageWhatIf = 1
# If WhatIf is 0 and Confirm is 1, then it prompts for confirmation
[bool] $EngageConfirmation = 1
# -------------------/

foreach ($key in Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged') {
   $itemProperty = $key | Get-ItemProperty
   $UnmanagedNetworkDesc = $itemProperty.Description
   $ProfileGuid = $itemProperty.ProfileGuid
   $PSChildName = $itemProperty.PSChildName
   $PathToUnmanaged = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged\$PSChildName"

   if ($UnmanagedNetworkDesc -notlike "$NetworkDescLIKE*") {
      continue
   }

   Write-Host -Fore Green "`nFound Unmanaged Network: $UnmanagedNetworkDesc -- ProfileGuid: $ProfileGuid -- Unmanaged Key: $PSChildName"

   # Fetch the Network Profile related to the Unmanaged Network's ProfileGuid:
   $PathToProfiles = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\$ProfileGuid"
   $ProfileName = (Get-ItemProperty -Path $PathToProfiles).ProfileName

   # If they match, delete the Unmanaged Network AND the related Network Profile:
   if ($ProfileName -eq $UnmanagedNetworkDesc) {
      # -Verbose enhances context
      Remove-Item $PathToProfiles, $PathToUnmanaged -WhatIf:$EngageWhatIf -Confirm:$EngageConfirmation -Verbose
   }
}

Write-Host -Fore Cyan "`nFound $countFound matching Network Profiles"
Write-Host -Fore Cyan "Deleted $countDeleted of those $countFound Network Profiles"
Sign up to request clarification or add additional context in comments.

6 Comments

You could remove the need for the if checks of $EngageWhatIf and $EngageConfirmation using the syntax -WhatIf:$EngageWhatIf and -Confirm:$EngageConfirmation
Thank you, @SantiagoSquarzon, for reformatting my question AND that tip! I knew about -WhatIf:$false or $true but overlooked that those are also variables albeit reserved! Great tip!
0 and 1 automatically coerce to a boolean ;)
@SantiagoSquarzon Yessir. I merely did not realize that I could assign my OWN variables to bind the condition, as I thought only $true or $false applied. I learned something from your tip and am appreciative!
Np! Glad you could learn something new :) this is how your approach could be simplified in case you're curious: gist.github.com/santisq/…
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.