Einstein197 Posted March 11, 2018 Share Posted March 11, 2018 In command prompt I use "netsh wlan start hostednetwork" how can I do that in autoit Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 11, 2018 Moderators Share Posted March 11, 2018 Einstein197, Welcome to the AutoIt forums. But in future, please no not resurrect old threads with only a passing relevance to your question. Just start a new thread as I have now done for you. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Subz Posted March 11, 2018 Share Posted March 11, 2018 RunWait(@ComSpec & " /c netsh wlan start hostednetwork", "", @SW_HIDE) ;~ Runs command hidden Link to comment Share on other sites More sharing options...
Einstein197 Posted March 13, 2018 Author Share Posted March 13, 2018 Cool that it Link to comment Share on other sites More sharing options...
fawder Posted March 13, 2018 Share Posted March 13, 2018 how can this be ran as a local admin? Link to comment Share on other sites More sharing options...
TheSaint Posted March 13, 2018 Share Posted March 13, 2018 (edited) 2 hours ago, fawder said: how can this be ran as a local admin? Depends. If you don't mind some interaction, you could just place #RequireAdmin at the top of your script. But if you want to run with preset permissions, automation, then check out the RunAs or RunAsWait commands. Edited March 13, 2018 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
fawder Posted March 13, 2018 Share Posted March 13, 2018 RunAs("username", "hostname", "password", 0, "") $CMD = 'net stop "service name has spaces"' RunWait('"' & @ComSpec & '" /k ' & $CMD, @SystemDir) I get this in the command window: System error 5 has occurred. Access is denied. C:\Windows\SysWOW64> @TheSaint i was reading old posts and saw that you had a bunch of samples out there, but was not able to see/download any of them. appreciate your help!! Link to comment Share on other sites More sharing options...
Subz Posted March 13, 2018 Share Posted March 13, 2018 (edited) #RequireAdmin Local $sServiceName = "Service Name" RunWait(@ComSpec & ' /k net stop "' & $sServiceName & '"') Edited March 13, 2018 by Subz Fixed Syntax error missed single quote at end of line. Link to comment Share on other sites More sharing options...
fawder Posted March 13, 2018 Share Posted March 13, 2018 29 minutes ago, Subz said: #RequireAdmin Local $sServiceName = "Service Name" RunWait(@ComSpec & ' /k net stop "' & $sServiceName & '") Hi @Subz when I test run, I get- error: syntax error (illegal character) and a yellow dot to the left of the last line. thanks!! Link to comment Share on other sites More sharing options...
Earthshine Posted March 13, 2018 Share Posted March 13, 2018 you know you can try to figure out what the syntax error is. you are supposed to learn, not just take other people's code and run My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
fawder Posted March 13, 2018 Share Posted March 13, 2018 4 minutes ago, Earthshine said: you know you can try to figure out what the syntax error is. you are supposed to learn, not just take other people's code and run Thanks Earthshine - sorry i am not good at this stuff. been searching forums for the past week for this and how-to guides... Link to comment Share on other sites More sharing options...
Earthshine Posted March 13, 2018 Share Posted March 13, 2018 you can also use SC to turn on or off servers or config them. built into windows. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
gillesg Posted March 13, 2018 Share Posted March 13, 2018 1 hour ago, Subz said: #RequireAdmin Local $sServiceName = "Service Name" RunWait(@ComSpec & ' /k net stop "' & $sServiceName & '"') A single quote is missing Link to comment Share on other sites More sharing options...
fawder Posted March 13, 2018 Share Posted March 13, 2018 2 minutes ago, gillesg said: A single quote is missing Thanks @gillesg getting an error: System error 5 has occurred. Access is denied. C:\Users\username\Downloads\Auto IT\> -- #RequireAdmin - does this mean I need to be an administrator to run this? if so, this will not work. -- Context: End users have an application that sometimes requires the service to be restarted(stopped/started) They do not have admin rights to the computer. I'd like to create an executable that does this for them without me having to enter in the admin credentials at a prompt. -- i appreciate everyone's ideas. Link to comment Share on other sites More sharing options...
Earthshine Posted March 13, 2018 Share Posted March 13, 2018 SC start ServiceName can't get any easier, no quotes My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
fawder Posted March 13, 2018 Share Posted March 13, 2018 Just now, Earthshine said: SC start ServiceName can't get any easier, no quotes i will try this. thanks Earthshine! Link to comment Share on other sites More sharing options...
Earthshine Posted March 13, 2018 Share Posted March 13, 2018 you may still need Admin, but others on this site know what your script will need to give it admin power, I am sure My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
TheSaint Posted March 13, 2018 Share Posted March 13, 2018 16 minutes ago, fawder said: #RequireAdmin - does this mean I need to be an administrator to run this? if so, this will not work. So don't use it, just replace RunWait with RunAsWait. Look it up in the Help file for specific information about all the parameters. Example Local $sServiceName = "Service Name" RunAsWait("your username", "your domain", "your password", logon_flag, @ComSpec & ' /k net stop "' & $sServiceName & '"', "workingdir" [, show_flag [, opt_flag]]] ) Obviously you need to enter all the other required values (username, password, etc), use appropriate flags, specify the working directory maybe. fawder 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Einstein197 Posted March 13, 2018 Author Share Posted March 13, 2018 On 3/11/2018 at 5:18 AM, Subz said: RunWait(@ComSpec & " /c netsh wlan start hostednetwork", "", @SW_HIDE) ;~ Runs command hidden Thanks it worked perfectly Link to comment Share on other sites More sharing options...
fawder Posted March 14, 2018 Share Posted March 14, 2018 14 hours ago, TheSaint said: So don't use it, just replace RunWait with RunAsWait. Look it up in the Help file for specific information about all the parameters. Example Local $sServiceName = "Service Name" RunAsWait("your username", "your domain", "your password", logon_flag, @ComSpec & ' /k net stop "' & $sServiceName & '"', "workingdir" [, show_flag [, opt_flag]]] ) Obviously you need to enter all the other required values (username, password, etc), use appropriate flags, specify the working directory maybe. got it to run. thanks a bunch all!! RunAsWait($sUserName, $sDomain, $sPassword, 0, @ComSpec & ' /k net stop "' & $sServiceName) TheSaint 1 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