Chance1

Inconstancy of Upper and Lower case Letters with ControlSend

10 posts in this topic

#1 ·  Posted

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!

Share this post


Link to post
Share on other sites



#3 ·  Posted

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

Share this post


Link to post
Share on other sites

#4 ·  Posted

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted

You are right,  I will give it a shot

Share this post


Link to post
Share on other sites

#6 ·  Posted

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

Share this post


Link to post
Share on other sites

#7 ·  Posted

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.

Share this post


Link to post
Share on other sites

#8 ·  Posted

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

Sorry about that :)

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#9 ·  Posted

After closing StdinWrite, will the user be able to interact with powershell window then or no?

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