Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to import wireless profile

Status
Not open for further replies.

Briandr

MIS
Jul 11, 2003
177
US
Hi All,

I found this code online that imports a wireless profile.

When I go to run it I get a error about Line 3, Character 35, invalid character. I am not sure what it is complaining about. Am I missing something in the line above? It appears to look ok, but then again I don't really write code........Thanks.

option explicit
Dim wshShell, strComputer, strKeyPath, oReg, arrSubKeys, subkey, command
Set wshShell=WScript.CreateObject(“WSCript.Shell”)
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer=“.”
Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & _
strComputer & “\root\default:StdRegProv”)
strKeyPath=“Software\Microsoft\WZCSVC\Parameters\Interfaces\”
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
subkey=Replace(subkey, “{“, “”)
subkey=Replace(subkey, “}”, “”)
‘Used for testing: Wscript.Echo “WLAN.exe sp ” & subkey & ” CMH_Data_Network.xml”
command=“C:\WLAN.exe sp ” & subkey & ” C:\CMH_Data_Network.xml”
wshShell.run command, 6, True
Next
set wshshell=nothing
 
Change
Code:
Set wshShell=WScript.CreateObject("WSCript.Shell")
to
Code:
Set wshShell=CreateObject("WSCript.Shell")

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Thanks Mark.

I will be testing this out over next day or so.

Do you (or anyone else) know of a script out there for importing the wireless network card settings themselves?
 
Hi,

Still getting errors. Line 5, character 13. Was not getting an error with that line previously. Ideas?
 
I decided to try and re-use the original code I found as I was still getting errors after making the change. I copied and pasted the code back in from this forum. It ran without errors, but it failed to create the wireless profile. Not sure why the wireless profile won't create, but I am glad its not erroring out.......
 
To be honest I was surprised you had some code for this, to the best of my knowledge you can't do what you are trying to do because of the wireless security. If you could export the wireless security (which is encrypted) then it would totally bypass the security.

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
I manually entered the wireless key (which I knew) when I setup the profile. What I discovered was the xml file was polluted. It had those '/par' entries in all over the place. Once I cleaned it up I was good to go. It works and does so quite well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top