Skip to content

Instantly share code, notes, and snippets.

@pronichkin
Last active March 9, 2021 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pronichkin/62217505978adf247270525bc7a21f18 to your computer and use it in GitHub Desktop.
Save pronichkin/62217505978adf247270525bc7a21f18 to your computer and use it in GitHub Desktop.
Sample for installing .NET Framework on Windows when the component is “Disabled with payload removed” (which is the default OS configuration)
$ImagePath = '<insert path to your image.iso>'
$DiskImage = Get-DiskImage -ImagePath $ImagePath
$Access = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DiskImage.Access]::ReadOnly
$DiskImage = Mount-DiskImage -InputObject $DiskImage -Access $Access -PassThru
$Volume = Get-Volume -DiskImage $DiskImage
$Path = $Volume.DriveLetter + ':'
$Source = Join-Path -Path $Path -ChildPath 'Sources\SxS'
Add-WindowsCapability -Online -Name 'NetFX3~~~~' -Source $Source
$DiskImage = Dismount-DiskImage -InputObject $DiskImage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment