Skip to content

Commit

Permalink
Removes mounted ISOs when parent VHD/X image creation fails
Browse files Browse the repository at this point in the history
Fixes #166
  • Loading branch information
iainbrighton committed Feb 23, 2017
1 parent 5415b4d commit dd20d6a
Show file tree
Hide file tree
Showing 41 changed files with 1,570 additions and 1,502 deletions.
322 changes: 0 additions & 322 deletions Lib/WindowsImage.ps1

This file was deleted.

1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Other generous members of the community have written some comprehensive guides t
* Permits overriding VM generation with the Media\CustomData\VmGeneration property (#194)
* Adds -RepositoryUri parameter to Set-LabHostDefault to support internal repositories (partially implements #195)
* Changes default PowerShell gallery URI to HTTPS
* Removes mounted ISOs when parent VHD/X image creation fails (#166)

### v0.10.2

Expand Down
43 changes: 43 additions & 0 deletions Src/Private/Add-LabImageOptionalFeature.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
function Add-LabImageWindowsOptionalFeature {
<#
.SYMOPSIS
Enables Windows optional features to an image.
#>
[CmdletBinding()]
param (
## Source package file path
[Parameter(Mandatory, ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[System.String] $ImagePath,

## Mounted VHD(X) Operating System disk drive
[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
[ValidateNotNullOrEmpty()]
[System.String] $DestinationPath,

## Windows packages to add to the image after expansion
[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
[ValidateNotNull()]
[System.String[]] $WindowsOptionalFeature,

## DISM log path
[Parameter()]
[ValidateNotNullOrEmpty()]
[System.String] $LogPath = $DestinationPath
)
process {

WriteVerbose ($localized.AddingWindowsFeature -f ($WindowsOptionalFeature -join ','), $DestinationPath);
$enableWindowsOptionalFeatureParams = @{
Source = $ImagePath;
Path = $DestinationPath;
LogPath = $LogPath;
FeatureName = $WindowsOptionalFeature;
LimitAccess = $true;
All = $true;
Verbose = $false;
}
$dismOutput = Microsoft.Dism.Powershell\Enable-WindowsOptionalFeature @enableWindowsOptionalFeatureParams;

} #end process
} #end function Add-LabImageWindowsOptionalFeature
Loading

0 comments on commit dd20d6a

Please sign in to comment.