Skip to content

Instantly share code, notes, and snippets.

@ram-devsecops
Created March 1, 2018 23:45
Show Gist options
  • Save ram-devsecops/17d49bc25deb789e923a2170328190c9 to your computer and use it in GitHub Desktop.
Save ram-devsecops/17d49bc25deb789e923a2170328190c9 to your computer and use it in GitHub Desktop.
Install iso file using chocolatey
# First, download the ISO file from the internet (NOTE: you could equally use a locally stored ISO)
Get-ChocolateyWebFile 'WindowsSDK2008' "$env:temp\winsdk2008.iso" 'http://download.microsoft.com/download/f/e/6/fe6eb291-e187-4b06-ad78-bb45d066c30f/6.0.6001.18000.367-KRMSDK_EN.iso'
# Next, mount the ISO file, ready for using it's contents
$iso = Get-Item "$env:temp\winsdk2008.iso"
Mount-DiskImage -ImagePath $iso
#Get the drive letter where iso is mounted
$driveLetter = (Get-DiskImage $iso | Get-Volume).DriveLetter
# Run commands against the mounted ISO, in this case, run the setup.exe
Install-ChocolateyInstallPackage 'WindowsSDK2008' 'exe' '/q' "${driveLetter}:\Setup.exe"
# Unmount the ISO file when finished
Dismount-DiskImage -ImagePath $iso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment