Jump to content

Recommended Posts

Posted (edited)

Folks,

I have an issue I've been trying to solve for a while, I'm trying to add static routes in DHCP via a 121 route rule in Windows 2012 R2 is a brutal manual process and wanted to automate this via AutoIT.

 

When I use the "ControlGetText" everything displays properly in the MSG box but when I try and use "ControlSetText" or "ControlSend" the values won't display in the input box but the action comes back as successful?

Anyone able to help me with this? I'm thinking this might be an active window issue but i'm not sure.

Here is a part of my code.

 

$hWnd = WinWait("[TITLE:Add a Static Route]","", 10)
WinActivate($hWnd)

$Status = ControlSend($hWnd, "", "[CLASS:Edit; INSTANCE:4]", "192"); Does not add 192 to the text box.

Local $sTextEdit1 = ControlGetText($hWnd, "", "[CLASS:Edit; INSTANCE:1]")

ConsoleWrite ( "ControlSend Status: " &  $Status & @CRLF); Returns a Value of 1

ConsoleWrite ( "ControlGetText Value Edit1: " &  $sTextEdit1 & @CRLF);

 

Please see attachment for more info.

DHCP Static Route.jpg

Edited by comtech80
Posted

@comtech80, do that with the route command line utility, not via GUI.

Signature - my forum contributions:

  Reveal hidden contents

 

Posted

sorry, i was in a hurry... for configuring DHCP scope from the command line, use the netsh command, instead of route. i never had to configure classless static routes myself, and i don't have adequate DHCP server at my disposal at the moment for testing - so i can't assist further, except directing you to this interesting forum post.

note that scope option 249 was re-numbered to 121 since Windows 2008, and the IPADDRESS data type should be valid. try it out.

B.T.W in general - and specifically on a server - pretty much anything that can be configured in a GUI, can be configured by a command line script.

Signature - my forum contributions:

  Reveal hidden contents

 

  • 4 weeks later...
Posted
  On 11/10/2017 at 7:03 PM, orbs said:

...in general - and specifically on a server - pretty much anything that can be configured in a GUI, can be configured by a command line script.

Expand  

I tend to agree, but I'd also admonish they mostly tend to be accessible via powershell (when it comes to Windows of course).

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
×
×
  • Create New...