Jump to content

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


chiners_68
 Share

Recommended Posts

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]

Link to comment
Share on other sites

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]

Link to comment
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}")

Link to comment
Share on other sites

  • Moderators

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

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

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
Link to comment
Share on other sites

  • Moderators

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...