Jump to content
Sign in to follow this  
JasonM

AutoIT compiled exe in an SCCM Task Sequence

Recommended Posts

JasonM

I have a program that I can not package into an MSI for SCCM deployment so I was trying to script the install with AutoIT. We are using SCCM 2007 and need to put this application into a Task Sequence so that it installs during the image process of a new computer.

I compiled the script into an EXE. The script works and installs the application while I am logged into the computer but hangs and timeouts in the Task Sequence. I have found a few threads on this and tried adding an EXIT command to the end of the script and also set the option in the SCCM Package to "Allow users to interact with this program". Neither option helped. Here is my code.

; Script Start
Run("fh7ewks.exe")
WinWaitActive("FIREHOUSE Software 7.3","Welcome to FIREHOUSE Software 7.3")
Send("{SPACE}!n")
WinWaitActive("FIREHOUSE Software 7.3","Welcome to the FIREHOUSE Software 7.3 Setup Program.")
Send("!n")
WinWaitActive("FIREHOUSE Software 7.3","Setup will install FIREHOUSE Software in the following folder.")
Send("!n")
WinWaitActive("FIREHOUSE Software 7.3","Registration Information")
Send("City & Cpunty of Denver{TAB}Denver Fire Department{TAB}{TAB}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}!n")
WinWaitActive("FIREHOUSE Software 7.3","Confirm Registration Information")
Send("!n")
WinWaitActive("FIREHOUSE Software 7.3","Backup Replaced Files")
Send("!o!n")
WinWaitActive("FIREHOUSE Software 7.3","Additional Installation Options")
Send("!n")
WinWaitActive("FIREHOUSE Software 7.3","Connect to Database")
Send("!n")
WinWaitActive("FIREHOUSE Software 7.3","Configuration Location")
Send("!n")
WinWaitActive("FIREHOUSE Software 7.3","Start Installation")
Send("!n")
WinWaitActive("Remote Configuration - FIREHOUSE Software")
WinClose("Remote Configuration - FIREHOUSE Software")
;Send("{TAB}{TAB}w{TAB}firehouse{TAB}FH!l")
Sleep(5000)
;Send("{TAB}{TAB}dan{TAB}12345678{TAB}{SPACE}{TAB}{ENTER}")
WinWaitActive("Installation Complete")
Send("{SPACE}!f")
ShellExecuteWait(".\Utilities\FHPerm.bat")
Exit

Share this post


Link to post
Share on other sites
water

Maybe this is true for your situation as well.

So use WinExists() and ControlSend().


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
JasonM

I am learning how to use the ControlSend and so far it is working but I can not get the WinExists to work.

If I use the WinWaitActive with the ControlSend as below the Script will put a check in the correct box and hit the Next button to go to the next screen.

Run("fh7ewks.exe")
WinWaitActive("[CLASS:GLBSWizard]")
ControlSend("FIREHOUSE Software 7.3","Welcome to FIREHOUSE Software 7.3","[CLASSNN:Button1]", "{SPACE}!n")

But if I use the WinExists in the same manner it will not check the box or hit the next button so the script just stalls.

WinExists("[CLASS:GLBSWizard]")
ControlSend("FIREHOUSE Software 7.3","Welcome to FIREHOUSE Software 7.3","[CLASSNN:Button1]", "{SPACE}!n")

Share this post


Link to post
Share on other sites
iamtheky

in an if statement?

If WinExists("[CLASS:GLBSWizard]") Then

ControlSend("FIREHOUSE Software 7.3","Welcome to FIREHOUSE Software 7.3","[CLASSNN:Button1]", "{SPACE}!n")


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
JasonM

I tried an IF statement and it still does not send the keys to the installer.

Share this post


Link to post
Share on other sites
omikron48

Have you tried using ControlClick?

Share this post


Link to post
Share on other sites
JasonM

I am going to try ControlClicks tomorrow and will post the results. I'm not so sure those are the problem. I think the problem is that there is not a normal user logged into the computer when the application is installing so the WinWaitActive might be the wrong command. Is there a way to install programs using ControlClick and ControlSend when no user is logged into to Windows?

Share this post


Link to post
Share on other sites
JasonM

I tried an IF statement with ControlClick but I still can not get the WinExists to work. Here is the code. It seems like it is fairly easy to use but maybe I am missing something.

If WinExists("[CLASS:GLBSWizard]") Then
ControlClick("FIREHOUSE Software 7.3","Welcome to FIREHOUSE Software 7.3","[CLASSNN:Button1]")
EndIf

Here is what the AutoIT windo info gives me. Maybe I need to ues something else. I tried the Title and some of the text.

>>>> Window <<<<

Title: FIREHOUSE Software 7.3

Class: GLBSWizard

Position: 284, 122

Size: 500, 387

Style: 0x94C80080

ExStyle: 0x00000101

Handle: 0x00050240

>>>> Control <<<<

Class:

Instance:

ClassnameNN:

Name:

Advanced (Class):

ID:

Text:

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle:

>>>> Mouse <<<<

Position: 553, 135

Cursor ID: 2

Color: 0x0055E7

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

New Installation

Update Existing Installation

Skip automatic search for existing installations

&Next >

Cancel

This option will allow you to install FIREHOUSE Software for the first time on this workstation or install additional instances on this workstation. You will not be given the option to update an existing installation.

This option will update an existing installation of FIREHOUSE Software on this workstation. The local hard drive will be searched for existing installation locations. This search may take several minutes. If you would prefer to skip the search and specify the location manually, place a check mark in the box below.

Welcome to FIREHOUSE Software 7.3

To proceed, please select the type of setup to perform...

>>>> Hidden Text <<<<

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  

×