Back in June 2012 I posted the Automated download and Installation for the Windows Assessment and Deployment kit article. Not a lot has changed since then,i.e. you still need to first download the sources before you can install them. Nevertheless since using batch scripts isn’t really state of the art anymore these days,I decided to rewrite the script in PowerShell.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
function Setup-ADK { <# .Synopsis Setup-ADK provides ADK download and install options .DESCRIPTION The Setup-ADK cmdlet provides options to download or install an individual feature from the Windows Assessment and Deployment Kit (ADK). Before using this script download the ADKSetup.exe (download launcher) from https://developer.microsoft.com/en-us/windows/hardware/windows-assessment-deployment-kit and place the file in the script folder example: C:\DEV\Utilities\SetupADK Additional Information https://developer.microsoft.com/en-us/windows/hardware/windows-assessment-deployment-kit https://msdn.microsoft.com/windows/hardware/commercialize/what-s-new-in-kits-and-tools#windows-imaging-and-configuration-designer-icd https://technet.microsoft.com/en-us/itpro/windows/manage/appv-install-the-sequencer https://technet.microsoft.com/en-us/itpro/windows/manage/appv-release-notes-for-appv-for-windows .PARAMETER Download Instructs the cmdlet to run in download mode .PARAMETER Path The path where the downloaded ADK instalation sources are stored .PARAMETER Install Instructs the cmdlet to run in install mode .PARAMETER Feature The ADK feature to install Note that the cmdlet only supports installing one feature at a time. .PARAMETER ADKSource The ADK installation source path .EXAMPLE Setup-ADK -Download -Path c:\temp\ADKSources Starts the download and stores the sources in c:\temp\ADKSources .EXAMPLE Setup-ADK -Install -Feature UserStateMigrationTool -ADKSource c:\temp\ADKSources .EXAMPLE Setup-ADK -Install -Features "DeploymentTools","WindowsPreInstallationEnvironment","UserStateMigrationTool" -ADKSource $PSScriptRoot Installs multiple features at once c:\temp\ADKSources .NOTES version 1.1, 19.01.2017, Alex Verboon version 1.1 10.09.2017, Francois Fournier, added ability to install multiple features #> [CmdletBinding()] Param ( # Instructs the cmdlet to run in download mode [Parameter(Mandatory=$true,ParameterSetName="Download", Position=0)] [switch]$Download, # The path where the downloaded ADK instalation sources are stored [Parameter(Mandatory=$true,ParameterSetName="Download", Position=1)] [string]$Path, # Instructs the cmdlet to run in install mode [Parameter(Mandatory=$true,ParameterSetName="Install", Position=0)] [switch]$Install, # The ADK feature to install [Parameter(Mandatory=$true,ParameterSetName="Install", Position=1)] [validateset("ApplicationCompatibilityToolKit","DeploymentTools", "WindowsPreInstallationEnvironment","ImagingAndConfigurationDesigner", "ICDConfigurationDesigner","UserStateMigrationTool","VolumeActivationManagementTool", "WindowsPerformanceToolkit","WindowsAssessmentToolkit", "WindowsAssessmentServicesClient","sqlExpress2012", "UEVTools","AppmanSequencer","MediaeXperienceAnalyzer" )] [string[]]$Features, # The ADK installation source path [Parameter(Mandatory=$true,ParameterSetName="Install", Position=2)] [string]$ADKSource ) Begin { If (Get-Process -Name adksetup -ErrorAction SilentlyContinue) { Write-Error "An instance of adksetup is already running" Break } if ($PSBoundParameters.ContainsKey("Download")) { Write-Verbose "Checking download prerequisites" #Check if the adksetup.exe download launcher is present If (Test-Path "$PSScriptRoot\adksetup.exe") { Write-verbose "Adksetup.exe download launcher located" $AdkExe = "$PSScriptRoot\adksetup.exe" } Else { Write-Error "$PSScriptRoot\adksetup.exe could not be found" Break } } if ($PSBoundParameters.ContainsKey("Install")) { Write-Verbose "Checking Installation prerequisites" #Check if the adksetup.exe installer is present If (Test-Path "$ADKSource\adksetup.exe") { Write-verbose "Adksetup.exe Install launcher located" $AdkExe = "$ADKSource\adksetup.exe" } Else { Write-Error "$ADKSource\adksetup.exe ADK Installer could not be found in $ADKSource" Break } } } Process { if ($PSBoundParameters.ContainsKey("Download")) { Write-output "Starting ADK Download to $Path" Write-output "Please wait, depending on your network connection this can take a few minutes" $AdkArgs = "/quiet /InstallPath $Path /layout $Path" $proc = Start-Process $AdkExe -ArgumentList $AdkArgs -PassThru -Wait } write-host "test" if ($PSBoundParameters.ContainsKey("Install")) { Write-output "Starting Install of $Features" #prefix Features with "OptionId." $Featurelist = $Features -replace "^","OptionId." $AdkArgs = "/features $FeatureList /quiet /norestart" $proc = Start-Process $AdkExe -ArgumentList $AdkArgs -PassThru -Wait } } End { Write-Output "Completed" } } |
Downlload source from GitHub