-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path00_UnpackToVHDX.ps1
42 lines (35 loc) · 1.43 KB
/
00_UnpackToVHDX.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
40
41
42
<#
.SYNOPSIS
The script create a VHD/X File and copy the MSIX Data in it
.DESCRIPTION
Use this script to create a MSIX App Attach Container
.NOTES
Version: 1.0
Author: Manuel Winkel <www.deyda.net>
Creation Date: 2020-06-04
Purpose/Change:
#>
#region variables
$vhdSrc="c:\output\Firefox.vhdx"
$packageName = "MozillaFirefox121.0.1x64de_121.0.1.0_x64__7x36akz78spd8"
$parentFolder = "MSIX"
$msixmgrPath = "C:\MSIX\msixmgr"
$msixPath = "c:\MSIX\"
$parentFolder = "\" + $parentFolder
$parts = $packageName.split("_")
$volumeName = "MSIX-" + $parts[0]
$packagePath = $msixPath + $packageName + ".msix"
#endregion
#Generate a VHD or VHDX package for MSIX
new-vhd -sizebytes 1024MB -path $vhdSrc -dynamic -confirm:$false
$vhdObject = Mount-VHD $vhdSrc -Passthru
$disk = Initialize-Disk -Passthru -Number $vhdObject.Number
$partition = New-Partition -AssignDriveLetter -UseMaximumSize -DiskNumber $disk.Number
Format-Volume -FileSystem NTFS -Confirm:$false -DriveLetter $partition.DriveLetter -Force
$Path = $partition.DriveLetter + ":" + $parentFolder
#Create a folder with Package Parent Folder Variable as the name of the folder in root drive mounted above
new-item -path $Path -ItemType Directory
Set-Volume -DriveLetter $partition.DriveLetter -NewFileSystemLabel $volumeName
#Expand MSIX in CMD in Admin cmd prompt - Get the full package name
cd $msixmgrPath
.\msixmgr.exe -Unpack -packagePath $packagePath -destination $Path -applyacls