caramen Posted November 5, 2018 Posted November 5, 2018 (edited) Hello AutoIT Helpers Trying to run the following as administrator but can't get it work. #include <Constants.au3> Local $foo = Run (@ComSpec & " netcfg –v –u ms_ndiswanip", @SystemDir ) RunAs ("ACCOUNT","DOMAIN.com","PASSWORD",@ComSpec & " netcfg –v –u ms_ndiswanip" , @SystemDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD) Seem like i'm missing something. Run and RunAs are not working. If i read the line it return me 0 Like if the command does not got rights I guess. If i run manualy the command in a CMD runed as administrator it s working. Just want to do that at end. Guess there is somthing special in this command. For information i got a 64 bits OS The " netcfg –v –u ms_ndiswanip " When i look into system32 I have netcfg.exe But i dont got it in Syswow64 The strange thing is if i run manualy my cmd as admin. It will execute the syswow64 cmd. And then i will be able to execute my netcfg from there. §There is somthing i cant figure out. PLease help me Edited November 5, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Moderators JLogan3o13 Posted November 5, 2018 Moderators Posted November 5, 2018 So what do you see when you add "/k " to your run or runAs command, to keep the window open? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Developers Jos Posted November 5, 2018 Developers Posted November 5, 2018 9 minutes ago, JLogan3o13 said: So what do you see when you add "/k " to your run or runAs command, to keep the window open? /c is missing totally so no surprise it doesn't work. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
BrewManNH Posted November 5, 2018 Posted November 5, 2018 You have the command to run, in the RunAs function, in the Logon_flag parameter position as well, so no wonder it won't work that way. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
caramen Posted November 5, 2018 Author Posted November 5, 2018 (edited) I paste that code but i tryed lot of syntaxt./ sorry it was unclear Hmmmm Run (@ComSpec & " /c /k netcfg –v –u ms_ndiswanip", @SystemDir ) ;Not working (window disapear directly RunAs ("Administrateur",@ComputerName,"***",$RUN_LOGON_PROFILE,@ComSpec & " /c /k netcfg –v –u ms_ndiswanip" , @SystemDir);Not working at all Run (@ComSpec & " /k netcfg –v –u ms_ndiswanip", @SystemDir ) ;Working ( BUT no command sent ) RunAs ("Administrateur",@ComputerName,"***",$RUN_LOGON_PROFILE,@ComSpec & " /k netcfg –v –u ms_ndiswanip" , @SystemDir); Working ( BUT no command sent ) I dodge the problem like that but i whould prefer somthing more reliable. with less windows opened and as possible hidden. RunAs("Administrateur",@ComputerName,"SgtChewie38",$RUN_LOGON_PROFILE,"c:\windows\syswow64\cmd.exe", @SystemDir, @SW_SHOW) $cHNW = WinWait ("c:\windows") Send ("runas /user:Administrateur cmd") Send("{ENTER}") Sleep(300) Send ("***");Password Send("{ENTER}") Sleep(300) $cHNW2 = WinWait ("cmd (en tant") Send ("netcfg.exe -v -u ms_ndiswanipV6") Send ("{ENTER}") Sleep(1000) Send ("netcfg.exe -v -u ms_ndiswanip") Send ("{ENTER}") Sleep (1000) Then i need the @comspec. When i run the command manualy ( i got white cmd so dont be suprised ) But that show it run it from different accuont?. 5 Lines in total Terminé mean in this case "sucess" But this is when i run from autoIT 4 lines total Nothing sent to me. I am hightligthing the line between the two c:\ to be sure it s not black text. But nothing. I cant even see if it s sucess or fail or ... Btw the black console does not seem to be admin. Edited November 5, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Nine Posted November 5, 2018 Posted November 5, 2018 Run (@ComSpec & " /c netcfg –v –u ms_ndiswanip", @SystemDir ) Try this line ... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy
caramen Posted November 5, 2018 Author Posted November 5, 2018 (edited) 25 minutes ago, Nine said: Run (@ComSpec & " /c netcfg –v –u ms_ndiswanip", @SystemDir ) Try this line ... $cDisk = RunAs ("Administrateur",@ComputerName,"SgtChewie38",$RUN_LOGON_PROFILE,@ComSpec & "/k /c netcfg –v –u ms_ndiswanip", @SystemDir ,$STDERR_CHILD + $STDOUT_CHILD ) ;Nothing Window disapeard so i cannot check if it 's succed Run (@ComSpec & "/k /c netcfg –v –u ms_ndiswanip", @SystemDir ) ; /C is'nt a recognised command Run ( @ComSpec & " /c netcfg –v –u ms_ndiswanip", @SystemDir ) ; Not admin and cant check µTryed same with show flag = same Edited November 5, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Nine Posted November 5, 2018 Posted November 5, 2018 Run (@ComSpec & " /c netcfg.exe –v –u ms_ndiswanip > test.txt" , "" ) compiled it and runned the exe as an admin, result will be in test.txt “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy
caramen Posted November 5, 2018 Author Posted November 5, 2018 Trying tomorow. Good way for testing ty. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
caramen Posted November 6, 2018 Author Posted November 6, 2018 16 hours ago, Nine said: Run (@ComSpec & " /c netcfg.exe –v –u ms_ndiswanip > test.txt" , "" ) compiled it and runned the exe as an admin, result will be in test.txt Text.txt = blank My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Developers Jos Posted November 6, 2018 Developers Posted November 6, 2018 Try running it in X64 mode. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
caramen Posted November 6, 2018 Author Posted November 6, 2018 (edited) 1 minute ago, Jos said: Try running it in X64 mode. Jos just to be sure... you mean compil it in x64? Edited November 6, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Developers Jos Posted November 6, 2018 Developers Posted November 6, 2018 Either compile as x64 or run it with AutoIt3_x64.exe. Use the AutoIt3Wrapper directive when you have the full version of SciTE4AutoIt3 installed. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
caramen Posted November 6, 2018 Author Posted November 6, 2018 3 minutes ago, Jos said: Either compile as x64 or run it with AutoIt3_x64.exe. Use the AutoIt3Wrapper directive when you have the full version of SciTE4AutoIt3 installed. Jos Nothing change it s same the txt file is blank. Btw..i do not changed the code actually i run this : Run (@ComSpec & " /c netcfg.exe –v –u ms_ndiswanip > test.txt" , "" ) My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
caramen Posted November 6, 2018 Author Posted November 6, 2018 (edited) I guess it is the netcfg tool that is realy special. I dont know how to manage it. Should I give up automatig it this way ? Btw everyone cant test out the script since that command disabling IP V6&Wan settings nothing else. Edited November 6, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Developers Jos Posted November 6, 2018 Developers Posted November 6, 2018 (edited) Ok, i understand now what the issue is. The pasted code it UTF8 encoded which causes some issues. Try this line: Run (@ComSpec & " /k netcfg.exe -v -q ms_ndiswanip > test.txt 2>&1" ) .. and check by changing the File Encoding to Ansi ( File/Encoding/Code Page Property 2 hours ago, caramen said: Btw everyone cant test out the script since that command disabling IP V6&Wan settings nothing else. I replaced the -u with -q so it only does a Query ...safer? Jos Edited November 6, 2018 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
caramen Posted November 6, 2018 Author Posted November 6, 2018 14 minutes ago, Jos said: I replaced the -u with -q so it only does a Query ...safer? I have to test if it repeiring my vpn issue still. I have to reproduce the bug and test the line i ll need some time i come back here. Thx Jos for spending time for me. Just for my understanding. 15 minutes ago, Jos said: The pasted code it UTF8 encoded which causes some issues. That mean it s the Forum page that show the text in UTF8 ? and if i copy past it s uncorrect then ? Or can you explain me ? My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Developers Jos Posted November 6, 2018 Developers Posted November 6, 2018 Just do what I stated in my post: 17 minutes ago, Jos said: .. and check by changing the File Encoding to Ansi ( File/Encoding/Code Page Property When I use your posted code in SciTE and run it, I have the same issue. So when I change the encoding i see: Quote Run (@ComSpec & " /c netcfg.exe –v –u ms_ndiswanip > test.txt") So that means that the "-v -u" are UTF doublebyte characters in stead of ANSI characters. CHange them to ANSI Characters and try your script again. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
caramen Posted November 6, 2018 Author Posted November 6, 2018 (edited) Well i dont need to reproduce bug it wont work with the -q I mean the query in'nt enouth to solve the wanted thing. I tested with -u and it's working test.txt output : Tentative de d‚sinstallation de ms_ndiswanip ... ... Termin‚. Same as : Now @Jos Could you explain me if i encode all my script like that will it change somthing ? Or it 's better to compile and run from external executable ? I am total newby in encoding... And ansi things.. i dont even know what is that i ll document myself. Edited November 6, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Developers Jos Posted November 6, 2018 Developers Posted November 6, 2018 (edited) 3 minutes ago, caramen said: Could you explain me if i encode all my script like that will it change somthing ? No need to change the encoding from utf8 (without BOM) to ANSI, but make sure you use ANSI characters on the commandline for Run(). Somewhere in the process the encoding gets lost, but I am not sure why it happens. Somebody will be able to tell us I am sure. Jos Edited November 6, 2018 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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