Public/Functions/split/Enable-PEWimPSGallery.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
function Enable-PEWimPSGallery { [CmdletBinding()] param ( [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName)] [string[]]$ImagePath, [Parameter(ValueFromPipelineByPropertyName)] [UInt32]$Index = 1 ) begin { #================================================= # Blocks #================================================= Block-WinPE Block-StandardUser #================================================= $ErrorActionPreference = "Stop" #================================================= } process { foreach ($Input in $ImagePath) { #================================================= $WindowsImageDescription = (Get-WindowsImage -ImagePath $Input).ImageDescription Write-Verbose "WindowsImageDescription: $WindowsImageDescription" if (($WindowsImageDescription -match 'PE') -or ($WindowsImageDescription -match 'Recovery') -or ($WindowsImageDescription -match 'Setup')) { $MountMyWindowsImage = Mount-MyWindowsImage -ImagePath $Input -Index $Index $MountMyWindowsImage | Enable-PEWindowsImagePSGallery $MountMyWindowsImage | Dismount-MyWindowsImage -Save } else { Write-Warning "Windows Image does not appear to be WinPE, WinRE, or WinSE" } #================================================= } } end {} } |