Wireless Zero Configuration on XP SP2

G

Guest

Guest
Archived from groups: microsoft.public.windows.networking.wireless (More info?)

Hi,

I am maintaining a Wireless utility for a company I work for and have a
problem with it running on Windows XP SP2.

The utility performs the following steps through an automated wizard :

1. Disable Ethernet
2. Enable Wireless
3. Purge any previous wireless cached connection credentials (to force
the user to re-authenticate)

It currently uses the WZCTOOL.exe to perform step 3 but this is not
working on SP2 - presumably because of the way that "Wireless Zero
Configuration" is operating.

My question is, how can I programmatically purge any previous wireless
cached connection credentials to force the user to re-authenticate,
while running Wireless Zero Configuration on Windows XP SP2.

Any help would be much appreciated.

Andrew
 
G

Guest

Guest
Archived from groups: microsoft.public.windows.networking.wireless (More info?)

Here's the code I ended up using. Note the "GUID" is the wireless
adapter GUID that I an getting by using "wzctool.exe", but it would be
pretty straight forward to get this by enumerating the
"SOFTWARE\Microsoft\WZCSVC\Parameters\Interfaces" registry key.

' /*
--------------------------------------------------------------------------------
*/

function PurgeWZCNetworks(GUID)

Dim Count, RegString, FINISHED, WSHShell

Count = 0
FINISHED = false

on error resume next

Set WSHShell = WScript.CreateObject("WScript.Shell")

call WSHShell.Run("NET STOP WZCSVC", 0, true)

do while (Not FINISHED)
RegString = "Static#" & Right("0000" & Count, 4)
if (Not
DeleteRegistryValue("SOFTWARE\Microsoft\WZCSVC\Parameters\Interfaces\"
& GUID, RegString)) then
FINISHED = true
end if
loop

call WSHShell.Run("NET START WZCSVC", 0, true)

Set WSHShell = nothing

end function

' /*
--------------------------------------------------------------------------------
*/

function DeleteRegistryValue(Path, Value)

dim oReg, code

on error resume next

Set
oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
code = oReg.DeleteValue(HKEY_LOCAL_MACHINE, Path, Value)

DeleteRegistryValue = (code = 0)

end function

' /*
--------------------------------------------------------------------------------
*/