Solved

Issue running AutoIT script as Scheduled Task / SCCM Task Sequence

Posted on 2013-06-21
4
2,523 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 51

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 51

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

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.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now