Private/Install-Icd.ps1
# Copyright 2019 David Haymond. # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. function Install-Icd { [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = 'Medium' )] [OutputType([bool])] param( [switch] $Force ) if ($Force -or $PSCmdlet.ShouldContinue( "The Windows Imaging and Configuration Designer is required but could not be found. " + "Would you like to install it?", "Install ICD" )) { $apkUrl = 'https://go.microsoft.com/fwlink/?linkid=2271337' $adksetup = Join-Path -Path $script:TEMPDIR -ChildPath 'adksetup.exe' $adkArgs = ('/features', 'OptionId.ImagingAndConfigurationDesigner', '/q', '/ceip', 'off') Invoke-WebRequest -Uri $apkUrl -OutFile $adksetup Start-Process -FilePath $adksetup -ArgumentList $adkArgs -Wait return $true } return $false } |