Solved

Issue running AutoIT script as Scheduled Task / SCCM Task Sequence

Posted on 2013-06-21
4
2,569 Views
Last Modified: 2013-06-24
I need to be able to kick off MBAM encryption on our Windows 7 desktops. There is no command line utility for doing this so I must use the GUI.

This AutoIT script will work if it is run normally - i.e. I double click on it
It will also work within SCCM if I set it to allow the user to interact with it.

Ideally I need to run this during an SCCM Task sequence - which will not allow it to run interactively. I thought therefore I would use SCCM to deploy a Scheduled task that would run when the user logs in for the first time - but that fails too. The application launches but the keypresses are not executed.

Here is my code...

Thanks in advance!


Func _WinWaitActivate($title,$text,$timeout=0)
	WinWait($title,$text,$timeout)
	If Not WinActive($title,$text) Then WinActivate($title,$text)
	WinWaitActive($title,$text,$timeout)
EndFunc

Run('C:\Program Files\Microsoft\MDOP MBAM\MBAMClientUI.exe')
_WinWaitActivate("Microsoft BitLocker Administration and Monitoring","")
Send("{TAB}{TAB}{CTRLDOWN}s{CTRLUP}{ALTDOWN}s{ALTUP}{ALTDOWN}co")

Open in new window

0
Comment
Question by:aideb
  • 2
4 Comments
 
LVL 52

Accepted Solution

by:
Joe Winograd, EE MVE earned 250 total points
ID: 39265978
I suggest you upgrade to the current version of AutoHotkey:
http://www.autohotkey.com/

If you have older scripts, select the ANSI 32-bit install rather than Unicode 64-bit.

Create an AHK file, e.g. [mbam.ahk], with this code:
SetTitleMatchMode,2
Run,"C:\Program Files\Microsoft\MDOP MBAM\MBAMClientUI.exe"
Loop
{
  IfWinExist,Microsoft BitLocker Administration and Monitoring
  Break
}
Send {Tab}{Tab}^s!s!co

Open in new window

After installing AutoHotkey, it will own the AHK file type, so all you need to do in Task Scheduler is point it to [mbam.ahk], or whatever you called it. It never ceases to amaze how results vary from one person to the next, but I can tell you that the code above (for a different executable and sending different keystrokes) works perfectly here in the W7 Task Scheduler. Regards, Joe
0
 
LVL 29

Assisted Solution

by:matrixnz
matrixnz earned 250 total points
ID: 39268310
0
 
LVL 2

Author Closing Comment

by:aideb
ID: 39271985
I actually found that manage-bde was able to achive this.

Thanks for the help though.
0
 
LVL 52

Expert Comment

by:Joe Winograd, EE MVE
ID: 39272012
You're welcome. And thanks to you for posting the solution that worked for you...and for the points! Regards, Joe
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
OfficeMate Freezes on login or does not load after login credentials are input.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question