chiners_68 Posted September 26, 2006 Share Posted September 26, 2006 how can i run this to add a domain user to the local admin group.. works ok from the run command but cant get it to run in autoit. net localgroup "Administrators" /ADD Domain\user I was trying run("net localgroup 'Administrators' /ADD Domain\user") Link to comment Share on other sites More sharing options...
AceLoc Posted September 26, 2006 Share Posted September 26, 2006 (edited) how can i run this to add a domain user to the local admin group.. works ok from the run command but cant get it to run in autoit. net localgroup "Administrators" /ADD Domain\user I was trying run("net localgroup 'Administrators' /ADD Domain\user") Run("net localgroup" & "'Administrators'" & "/ADD Domain\user") thnk.. tell me if it works or if it dont Edited September 26, 2006 by aceloc [quote name='AceLoc']I gots new sunglasses there cool.[/quote] Link to comment Share on other sites More sharing options...
AceLoc Posted September 26, 2006 Share Posted September 26, 2006 (edited) if it dont then here you got an example of how it could work.Opt("WinTitleMatchMode", 2) $a = ("cmd.exe") Run($a, "", @SW_SHOWNORMAL) WinWaitActive($a) ControlSend($a, "", "", "net localgroup " & "Administrators " & "/ADD Domain\user") WinWaitActive($a) ControlSend($a, "", "", "{ENTER}") WinWaitActive($a) ;Controlsend($a, "", "", "exit{ENTER}")if you wanted to run it minimized then replace the "WinWaitActive's" with Sleep()Thnk Edited September 26, 2006 by aceloc [quote name='AceLoc']I gots new sunglasses there cool.[/quote] Link to comment Share on other sites More sharing options...
JaySquared Posted September 26, 2006 Share Posted September 26, 2006 Run("net localgroup" & chr(34) & "Administrators" & chr(34) & "/ADD Domain\user") That will put in the quotes where you need them. Aha.. I have unlocked it's secrets.. world domination is within my grasp... Link to comment Share on other sites More sharing options...
chiners_68 Posted October 2, 2006 Author Share Posted October 2, 2006 Thanks Guys, only AceLoc's works but the sleep dosent make it go minimized it just freezes Opt("WinTitleMatchMode", 2) $a = ("cmd.exe") Run($a, "", @SW_SHOWNORMAL) Sleep($a) ControlSend($a, "", "", "net localgroup " & "Administrators " & "/ADD Domain\user") Sleep($a) ControlSend($a, "", "", "{ENTER}") Sleep($a) ;Controlsend($a, "", "", "exit{ENTER}") Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 2, 2006 Moderators Share Posted October 2, 2006 (edited) Thanks Guys, only AceLoc's works but the sleep dosent make it go minimized it just freezesOpt("WinTitleMatchMode", 2)$a = ("cmd.exe")Run($a, "", @SW_SHOWNORMAL)Sleep($a)ControlSend($a, "", "", "net localgroup " & "Administrators " & "/ADD Domain\user")Sleep($a)ControlSend($a, "", "", "{ENTER}")Sleep($a);Controlsend($a, "", "", "exit{ENTER}")Sleep() requires a number in milliseconds, the amount of time you want to wait before going to the next function. You have $a as a String and are using it as the time to sleep.Edit:You also have parenthesis around cmd.exe that you need to remove.And $a is the Process ID of the executable running, not the title of the window. Edited October 2, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jvanegmond Posted October 2, 2006 Share Posted October 2, 2006 (edited) Run("net localgroup" & chr(34) & "Administrators" & chr(34) & "/ADD Domain\user")oÝ÷ Ù8Z·¥{az«¨µë0êÞʧyçm鿪ê-xýË«¦¸¬yÙè¢w¤,¶¢ºÞrÙ¶¡÷hx-+¶+Ø^«¢+ØÀÌØíÍÑÉ¥¹ôÌäí¹Ð±½±É½ÕÀÅÕ½Ðíµ¥¹¥ÍÑÉѽÉÌÅÕ½Ðì½½µ¥¸ÀäÈíÕÍÈÌäì(í=H(ÀÌØíÍÑÉ¥¹ôÅÕ½Ðí¹Ð±½±É½ÕÀÅÕ½ÐìÅÕ½Ðíµ¥¹¥ÍÑÉѽÉÌÅÕ½ÐìÅÕ½Ðì½½µ¥¸ÀäÈíÕÍÈÅսРEdited October 2, 2006 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 2, 2006 Moderators Share Posted October 2, 2006 I'm surprised noone knows the correct method of doing this.. It is either:$string = 'net localgroup "Administrators" /ADD Domain\user' ;OR $string = "net localgroup ""Administrators"" /ADD Domain\user"oÝ÷ Ûú®¢×¯+aÆ®¶sd÷BgV÷CµvåFFÆTÖF6ÖöFRgV÷C²Â"¤÷Bb33µ6VæD¶WFVÆb33²Â¤FÒb33cµBÒ'Vâb33¶6ÖBæWRb33²Âb33²b33²Â5uõ4õr¥&ö6W75vBb33cµB¥våvD7FfRõvävWD'Bb33cµB¥6VæBb33¶æWBÆö6Æw&÷WFÖæ7G&F÷'2ôDBFöÖâb3#·W6W"b33²¥6ÆVW¥6VæBb33·´TåDU'Òb33² ¤gVæ2õvävWD'Bb33c¶B Æö6Âb33c¶tÆ7BÒväÆ7B f÷"b33c¶42ÒFòb33c¶tÆ7E³Õ³Ð bvävWE&ö6W72b33c¶tÆ7E²b33c¶45Õ³ÒÒb33c¶BæBð &DäBvävWE7FFRb33c¶tÆ7E²b33c¶45Õ³ÒÂ"FVà &WGW&âb33c¶tÆ7E²b33c¶45ճРVæD` æW@ &WGW&â6WDW'&÷"¤VæDgVæ Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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