Sign in to follow this  
Followers 0
chiners_68

im on a roll today.. cant get this to run

8 posts in this topic

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")

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by aceloc

[quote name='AceLoc']I gots new sunglasses there cool.[/quote]

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by aceloc

[quote name='AceLoc']I gots new sunglasses there cool.[/quote]

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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}")

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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}")

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 by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by Manadar

Share this post


Link to post
Share on other sites

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æ

[center]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.[/center]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0