Private/Install-Icd.ps1
# SPDX-FileCopyrightText: © 2022 David Haymond <david@davidhaymond.dev> # # SPDX-License-Identifier: GPL-3.0-or-later 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" )) { $adksetup = Join-Path -Path $script:TEMPDIR -ChildPath 'adksetup.exe' $adkArgs = ('/features', 'OptionId.ImagingAndConfigurationDesigner', '/q', '/ceip', 'off') Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/?linkid=2196127' -OutFile $adksetup Start-Process -FilePath $adksetup -ArgumentList $adkArgs -Wait return $true } return $false } |