smcombs Posted April 19, 2009 Share Posted April 19, 2009 Is there a way from the command line that I can find out which wireless profile is in use at the moment? I am trying to set static IP's when I am on specific networks and sometimes I am not available to access the router where I am at. Here is my code that I am trying to use to accomplish possible meaningless feat: CODEWhile 1 Sleep(1000) $test = StringSplit(@IPAddress1,".") If $test[4] = "7" Then Else ShellExecute("netsh", "interface ip set address wireless static 192.168.1.50 255.255.255.0 192.168.1.1 1") ProcessWaitClose("netsh.exe") ShellExecute("netsh", 'interface ip set dns "Wireless Network Connection" static 192.168.1.1 primary') ProcessWaitClose("netsh.exe") Else EndIf If $test[4] = "7" Then Else ShellExecute("netsh", "interface ip set address wireless static 192.168.2.7 255.255.255.0 192.168.2.1 1") ProcessWaitClose("netsh.exe") ShellExecute("netsh", "interface ip set dns 'Wireless Network Connection' static 192.168.2.1 primary") ProcessWaitClose("netsh.exe") EndIf WEnd I guess it would be alot easier for me to do this code if I could specify what wireless profile I am connected to and then use this command to set the ip. Any help or ideas suggestions are greatly appreciated. Thanks Link to comment Share on other sites More sharing options...
herewasplato Posted April 19, 2009 Share Posted April 19, 2009 If each "wireless profile" uses a different SSID... ...then some wireless NIC drivers write the current SSID to one of these subkeys: HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ Class\ {4D36E972-E325-11CE-BFC1-08002bE10318}\ 00xxx Other than the method above, I'm not sure how to tell. Maybe a WMI guru will stop by your thread. In your code, you might see if these two lines ShellExecute("netsh",... ProcessWaitClose("netsh.exe") can be replaced by ShellExecuteWait("netsh",.. Also, maybe these two lines If $test[4] = "7" Then Else can be replaced by If $test[4] <> "7" Then [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
rajeshontheweb Posted April 20, 2009 Share Posted April 20, 2009 would this help? Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now