Jump to content

Try to get network profile registries of Win7


Recommended Posts

Dear Sirs,

I will use VPN sometimes. The VPN client will connect to different VPN servers and leave a new network profile registries in my Win7 each time I use it. It's a bit scary when I see the network number keep increasing. However, I could manually remove those registries, and make the network number goes back to 0. That will make me feel comfortable. But it's tedious for trimming dozens of registries manually. An automatic way is really necessary for this job.

I am considering to write a AutoIt program to do it. My first step is trying to get the subkeys of those network profiles to see I could really handle it:

#RequireAdmin
#include <MsgBoxConstants.au3>

Local $sSubKey = ""
Local $i = 1

While 1
    $sSubKey = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles", $i)
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "Error", @error)
        ExitLoop
    EndIf
    MsgBox($MB_SYSTEMMODAL, "Subkey #" & $i & ":", $sSubKey)
    $i = $i + 1
WEnd

Too bad, I cannot get any registry at all, though I am pretty sure there are dozens of them there. The return error is -1: unable to retrieve requested subkey (key instance out of range)

I don't write AutoIt script for a long time. There might be something wrong in my code.

Any help will be appreciated.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...