The Deployment Guys

Helping to deploy your world automagically...

Useful Script Number 4 - Silent Installation of Windows AIK 1.1

Useful Script Number 4 - Silent Installation of Windows AIK 1.1

  • Comments 3
  • Likes

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 ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseAnsi=y
#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: 3.2.10.0
; 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

#include <Constants.au3>

;Set variables and constants
Dim $Item
Dim $sCmd

;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"
Else
    MsgBox(0,'Error','The processor type is not supported - Setup will now exit')
    Exit
EndIf

;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")
Send("!n")

; Wait for the EULA window to become active
WinWaitActive("Windows Automated Installation Kit", "License Terms")
Send("!a")
Send("!n")

; Wait for the Select Install Location window to become active
WinWaitActive("Windows Automated Installation Kit", "Select Installation Folder")
Send("!n")

; Wait for the Confirm Install windows to become active
WinWaitActive("Windows Automated Installation Kit", "Confirm Installation")
Send("!n")

; Wait for the Install Complete window to become active
WinWait("Windows Automated Installation Kit", "Installation Complete")
Send("!c")

; Wait for the Reboot Required window to become active (NO LONGER REQUIRED FOR WAIK VERSION 1.1)
;WinWait("Windows Automated Installation Kit", "")
;Send("!y")

Exit

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.

  • "there is a requirement to manually accept the licensing agreement" - funny how that isn't a requirement in a number of other Microsoft programs.  Seems like the legal department is causing pain for users - I would push back on this requirement.

  • You should consider that the Windows AIK is a vehicle for distributing an operating system - you get Windows PE as part of the Windows AIK - something that was only available to enterprise customers previously - so it doesn't surprise me that you have to accept the licence to install - it just doesnt help if you want to automate the creation of say a build server

    Richard S

  • Very useful Script which will help me with my Roll-Out of >100 Servers. Thanx for the great Idea to Using AutoIT.

    One Thing is still open, wenn the WAIK ist installed, i have to Configure the Deployment Server an Set up The Deployment share.

    Has someone already an Automated-Solution for this ?

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment