Sign in to follow this  
Followers 0
BigRedEO

DOS Boxes

10 posts in this topic

#1 ·  Posted (edited)

I am new to AutoIt, so please be kind.  I'm writing a script that will run an executable that upgrades OpenSSH on several remote computers.  It first uninstalls the old version then installs the new version.  I'm all the way through, but have run into one problem.  When it gets to the part of the executable where it actually starts installing/extracting all the files, about midway through, it stops and a DOS box pops up with a

____________ key already exists.
Overwrite (y/n)?

There are actually 3 boxes in a row with the same "Overwrite (y/n)?" prompt.  I've tried using

Send ("{y}")
Send ("{Enter}")

but no luck.  Any ideas please?

Edited by BigRedEO

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

What command are you running to extract the files?

It probably has a param to force overwrite, like /y, or something.  Oh, is this durring install?  There might be silent params, or you can probably delete the file as a setup step.

There are all kinds of Win* functions, and control* functions to manipulate gui's...I'd suggest you read up on those as a last resort.

WinGetHandle
WinExists
ControlGetHandle
ControlSend
ControlClick
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

What command are you running to extract the files?

It probably has a param to force overwrite, like /y, or something.

 

It's an executable - .exe file, so I'm simply doing "ControlClick" for each "Next" or "OK" button, so the command just before that extract is

WinWaitActive ("Create Password and Group files", "Choose user type for SSHD")
ControlClick ("Create Password and Group files", "&Next", 1)

and then it moves to the next window to extract.

Share this post


Link to post
Share on other sites

Try and do a full uninstall, that should remove the key that already exists from the previous install (old version), if a full uninstall is not one of the options then you can try and write a small script to delete the key from the registry manually.

Share this post


Link to post
Share on other sites

Try and do a full uninstall, that should remove the key that already exists from the previous install (old version), if a full uninstall is not one of the options then you can try and write a small script to delete the key from the registry manually.

 

That's what I was thinking I may have to do - write down each key it's asking for, then delete them before running this.  I'll give it a go.  Thank you!

Share this post


Link to post
Share on other sites

Even if it is an executable, it may allow for command line switches. Many Setup.exe's are just MSI wrappers these days. Can you provide a link to the location? I googled OpenSSH, but the main page just has "Alternatives for Windows Users"


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

And on the left side of that page is a very conspicuous link called "Silent install options". Have you tried these?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

And on the left side of that page is a very conspicuous link called "Silent install options". Have you tried these?

 

Yes - and unfortunately, not working.  This is on ancient Windows XP systems (that will finally get upgraded to Windows 7 this year, but for now...).  Deleting the keys works fine since the .au3 script will be called from a batch script doing other things as well.

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

  • Similar Content

    • fopetesl
      By fopetesl
      I need to be able to issue a command line which has a folder in parentheses as
       
      attrib +s +h "absolute folder to hide"  I've read through many posts here but nothing quite hacks how to use a variable as the folder in parentheses.
      I've tried
       
      Local $dosattrib = "attrib +s +h " & ""$hidFolder"" ; $hidFolder built up from decrypted encrypted C:\Hidden Folder which I do not want visible when compiled version is reverse engineered  which errors with excess parentheses but in single "" it doesn't work.
      There seems to be a relatively complicated method to make it work but surely there's a simple way?
       
       
    • TheDcoder
      By TheDcoder
      Hello Everyone , Are you tired of searching the forum for getting both the exit code & the stdout output? Then you are in the right place!

      With this UDF you can get the both output & exit code of the command or the console app! Or you can get the exit code of another process without having to use RunWait...
      Features:
      1. Simple & Lightweight (15 KB)
      2. Detailed comments & description
      3. Flexible functions with many optional parameters
      A BIG THANKS TO PsaltyDS for the functions! 2 of the (main) functions in the UDF are his work
       
      List of functions:
      Downloads:
      Grab the latest (in development) code from GitHub
       
      Hope it may help you, TD
       
      P.S Icon made by Freepik from www.flaticon.com, Modified by TheDcoder
    • Baboo85
      By Baboo85
      Hi all,
      I need to start a script that include:
      - admin privileges
      - multiple cmd commands
      - no bat, no exe, no tmp files created anywhere (especially in the user temp folder)
      In a bat file it would be simple, but users shouldn't see what commands I'm sending.
      Example of the script:
      echo off cls echo. echo I AM A TOOL echo. echo NOTE: echo - note 1 echo - note 2 echo - etc set USER1=0 set COMPUTER1=0 if /i %username% equ user.user ( set USER1=1 set COMPUTER1=1 ) if /i %username% equ another.user set USER1=1 if /i %computername% equ notebook set COMPUTER1=1 if %USER1% EQU 1 ( if %COMPUTER1% EQU 1 ( reg delete "HKLM\SOFTWARE\blablabla" /f ) else ( echo Computer not authorized. Contact assistance.) ) else ( echo User not authorized. Contact assistance.) echo. pause exit With the send("") is a disaster.
      I'm a noob here, so what can I do?
       
      EDIT: OR ELSE I explain the situation and what I need, so if there is a simple solution I can use that.
       
      SITUATION: our domain users have Users rights on the machine. Some of them need administrator rights.
      We create a local user with administrator rights, so that the users must insert username and password when asked to run something with administrator rights.
      We have an internal domain group policy that blocks EXE, BAT, COM, TMP files from the user local temp directory, for a security reason (malware). That also blocks most software installation.
      But some users are often out of office, away from workplace and in another country, they need a complete control on their computers.
       
      WHAT I NEED: I need to check the username and the computer name. If the username is the one with local administrator rights and the computer name is a computer that is qualified to temporary remove the policy, then I need to execute a REG DELETE command with administrator rights.
       
      I hope I explained myself.
       
      Thank you very much.
    • fopetesl
      By fopetesl
      I have problems running both Bat files and Command line instructions.
      This function hopefully shows what I have tried so far
      Global $fFileToCreate = "", $DOS ScanFilm($fFileToCreate) Func ScanFilm($fFileToCreate) MsgBox($MB_SYSTEMMODAL, "Scanning Status", $fFileToCreate) ; $DOS = Run(@ComSpec & " /c " & "scan.bat" & @CRLF, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $DOS = Run(@ComSpec & " /k " & "ncat 192.168.1.6 80 <scant.txt >scanrep", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ; $DOS = _RunDOS("ncat 192.168.1.6 80 <scant.txt >scanrep") ProcessWaitClose($DOS) $Message = StdoutRead($DOS) MsgBox($MB_SYSTEMMODAL, "Stdout Read:", $Message) Endfunc My first attempt running scan.bat reveals a bug in cmd.exe where the result of
      echo !SR | ncat 192.168.1.6 80 > scanrep is
      C:\S3_GUI\ncat>scan.bat C:\S3_GUI\ncat>echo scant.txt | ncat 192.168.1.6 80 1>scanrep Ncat: . C:\S3_GUI\ncat> note the added '1' which then throws the error, (when client is connected), "File or directory not found" so the command fails.  This has been run on four different computers running Windows 7 with same result.
      Next using Run() seems to truncate the command so $DOS reads:

      Using _RunDOS() doesn't throw any error but MsgBox() is empty.
       
       
       
       
       
       


    • Eddi96
      By Eddi96
      Hey guys!
      I need your help again. So I am working on a Project with which I can Logoff a User in a Terminal-Server (Windows Server 2012 R2), logged in as Admin. Then backup the users partition and log him back in. Sounds pretty easy for you guys, right? So my problem is... I seem to not be able to get the User ID. You can see and display the ID in a textfile with:
      Run("query user>>c:\users\example\desktop\helpmeguys.txt") This line just writes a textfile of "query user" on the desktop. This is an example on what it looks like:
       BENUTZERNAME          SITZUNGSNAME       ID  STATUS  LEERLAUF   ANMELDEZEIT
      >wg                                  console                       2  Aktiv                     17    25.07.2016 08:19

      What I need right now is the ID. Any Idea on how to read it off of the Textfile?
      Please give me examples because I am still a rookie!
       
      With kind regards
      Eddi96