One of the things that you may need to do – particularly if you are tying to automate the creation of a deployment server in a lab environment – is install the Windows Automated Installation Kit. You may think that because Windows AIK is supplied as .msi files that this would be a simple process, however there is a requirement to manually accept the licensing agreement with no switch to bypass and the msi is coded to only run in full UI mode. Also there is the issue of installing the correct version (x86/x64 versions) on the correct platform.
With this in mind, back when Windows AIK was released (v1.0), I created a small Autoit script to screen scrape the installation – I have now updated this script for Windows AIK 1.1
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;Copyright (C) 2008
;You have a royalty-free right to use, modify, reproduce and distribute the Sample Application Files (and/or any modified version) in any way
;you find useful, provided that you agree that Microsoft and the author have no warranty, obligations or liability for any Sample Application Files.
; AutoIt Version: 22.214.171.124
; Language: English
; Platform: Windows
; Author: Richard Smith – Microsoft UK
; Script Function:
; Gets CPU architecture then install the Windows Automated Installation Kit (Windows AIK 1.1) silently
;Set variables and constants
;Check the CPU architecture
$Item = @ProcessorArch
; Set the msi to be run based on architecture found
If $Item = "X86" Then
$sCmd = " waikx86.msi"
ElseIf $Item = "X64" Then
$sCmd = " waikamd64.msi"
ElseIf $Item = "IA64" Then
$sCmd = " waikia64.msi"
MsgBox(0,’Error’,’The processor type is not supported – Setup will now exit’)
;Run the installation command
Run ("msiexec.exe /i" & $sCmd)
;Program Installation Automation
; Wait for the Welcome window
WinWait("Windows Automated Installation Kit", "Welcome to the Windows Automated Installation Kit Setup Wizard")
; Wait for the EULA window to become active
WinWaitActive("Windows Automated Installation Kit", "License Terms")
; Wait for the Select Install Location window to become active
WinWaitActive("Windows Automated Installation Kit", "Select Installation Folder")
; Wait for the Confirm Install windows to become active
WinWaitActive("Windows Automated Installation Kit", "Confirm Installation")
; Wait for the Install Complete window to become active
WinWait("Windows Automated Installation Kit", "Installation Complete")
; Wait for the Reboot Required window to become active (NO LONGER REQUIRED FOR WAIK VERSION 1.1)
;WinWait("Windows Automated Installation Kit", "")
The first part of the script uses an Autoit function – @ProcessorArch to get the processor type of the machine that the script is being run on. Based on the processor found, the script sets the correct .msi file to run.
The script then uses the Autoit WinWait and WinWaitActive functions to wait for specific screens to appear and then uses the Send function to deliver the correct key stroke to that window.
As usual the Autoit source script (.au3 file) and the compiled executable (x86 .exe file) are available from the Deployment Guys SkyDrive – the executable must be placed into the Windows AIK 1.1 source directory (where the .msi files are) and run from there.
This post was contributed by Richard Smith – a Senior Consultant with Microsoft Services, UK.