decaces Posted March 3, 2017 Share Posted March 3, 2017 Hi!, I am new to the forum and have been using autoit for a couple of weeks. (sorry in advance for any noob questions) I have a script which does the following in multiple steps. - create a wifi profile (PEAP) - set prefered bandth to 5GHz (this is done by 2.exe on the end) And last create a username and ask for the password (which are needed to login to peap, due to architecture reasons windows creds are not possible) Now for the question, for some reason the password is not send in raw. As the passwords are randomised they do include special chars like &#!^ ect After some testing we discoverd it is not sending the special chars like # correctly. I hope someone can show me in the right direction Thanks in advance. expandcollapse popup#include "NativeWifi.au3" $CMD = "netsh wlan delete profile name=*" RunWait(@ComSpec & " /c " & $CMD) Local $oProfile, $oUserData, $sReason $fDebugWifi = True _Wlan_StartSession() $oProfile = _Wlan_CreateProfileObject() With $oProfile .Name = "*********" .SSID.Add("*******") .Type = "Infrastructure" .Auth = "WPA2" .Encr = "AES" .OneX.Enabled = True .OneX.Authmode = "User" .EAP.BaseType = "PEAP" .EAP.Type = "PEAP-MSCHAP" .EAP.PEAP.MSCHAP.UseWinLogonCreds = False .EAP.PEAP.FastReconnect = True EndWith _Wlan_SetProfile($oProfile, $sReason) $name=@Computername $password = InputBox($name, "Enter the password", "", "*") $oUserData = _Wlan_CreateUserDataObject() With $oUserData .BaseType = "PEAP" .Type = "PEAP-MSCHAP" .PEAP.MSCHAP.Username = ($name) .PEAP.MSCHAP.Password = Send($password, 1) EndWith _Wlan_SetProfileUserData("********", $oUserData) $Pref = "2.exe" RunWait(@ComSpec & " /c " & $Pref) Link to comment Share on other sites More sharing options...
water Posted March 3, 2017 Share Posted March 3, 2017 Send doesn't work this way. It is meant to send strings to a GUI. I would try: .PEAP.MSCHAP.Password = $password as you seem to use COM. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
decaces Posted March 3, 2017 Author Share Posted March 3, 2017 Thanks for the quick reply, I have tried the suggestion with a password like Welcome#1! $name=@Computername $password = InputBox($name, "Enter the password", "", "*") $oUserData = _Wlan_CreateUserDataObject() With $oUserData .BaseType = "PEAP" .Type = "PEAP-MSCHAP" .PEAP.MSCHAP.Username = $name .PEAP.MSCHAP.Password = $password But unfortunately it still seems pass on the wrong password. Link to comment Share on other sites More sharing options...
water Posted March 3, 2017 Share Posted March 3, 2017 You are sure that the system accepts passwords with special characters? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted March 3, 2017 Share Posted March 3, 2017 Another question: How do the _WLAN* functions return an error? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
decaces Posted March 3, 2017 Author Share Posted March 3, 2017 yes. when the password is given the script goes on. When it is done there should be a connection but instead windows is asking for additional credentials. (like: ) When they are entered in there directly it connects instantly. Also when i reset the password to something like "Password1" or something without the # in this case and run the script again with that password it works fine. unfortunately i dont have a error handeling. After entering the password it just goes on without checking if the creds work. So i dont get a Error back. ofcource i could reset al the passwords so that they dont have the blocking chars but that is a bit like giving up Link to comment Share on other sites More sharing options...
water Posted March 3, 2017 Share Posted March 3, 2017 The UDF returns some error information. I would check it this way: $sReturnValue = _Wlan_SetProfileUserData("********", $oUserData) If @error Then MsgBox(0, "Error", "@error = " & @error & ", @extended = " & @extended & ", return value = " & $sReturnValue) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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