Jump to content

Inconstancy of Upper and Lower case Letters with ControlSend


Recommended Posts

Hello, I am trying to send some commands to a powershell window using the ControlSend function. I get the handle of the powershell window and send the command, the command consists of upper and lower case letters within words, as well as '-' and variables. The ControlSend will also change the variables that are being send to the powershell (by change the variables I mean it changes the letters from upper to lower as well as changing say a zero '0' to ')' ).

There is no pattern as sometimes the command is sent properly, but more times than not, the command has something wrong.

Has anyone experienced this before? Know of a way to fix this? Thanks!

Link to comment
Share on other sites

  • Developers
Link to comment
Share on other sites

@Jos that may help a little bit. but, the problem is that there is a mixture in the controlsend. Here is what I am trying to send to the powershell.

ControlSend($hWnd, '', '', 'Enter-PSSession -ComputerName ' & $Domain & ' -Credential ' & $TargetUsername )

(So that is a powershell command being sent to the powershell window with Autoit). So that link may be helpful, but it might be too tedious to have to force the shift, ALT, or Crtl key to do down or not.

Link to comment
Share on other sites

  • Developers

I don't know what else you do on the computer to make one of those keys stick, but let me ask you why are you interacting with powershell via the front in stead of the STDIO method?  When you shell powershell from the script, you should be able to send commands that way and not be bothered by other influences.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

@Jos this is an unrealted question to the topic but to what you suggested. When I run the powershell and try to use STDIO, I cannot see the powershell commands being send so I am not sure how to test this code. When I use @SW_SHOW or @SW_MAXIMIZE  i just get a blank powershell window running. So I do not know if the commands are working or not.

Link to comment
Share on other sites

Also, By the end of the script executing, I want the user to be able to interact with the powershell window. The point of the script is to sign in the user onto a Domain. So I am not sure if using Run this way will allow for this.

Link to comment
Share on other sites

  • Developers

You are correct that when using STDIO, the user won't see the information anymore. in the powershell window. 

Sorry about that :)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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