-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c05b1e7
commit 3738b6c
Showing
9 changed files
with
453 additions
and
305 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
@exit /b | ||
|
||
:embed: | ||
[Environment]::CurrentDirectory = (Get-Location -PSProvider FileSystem).ProviderPath | ||
Add-Type -Path .\Microsoft.Dism.dll | ||
$Dism = [Microsoft.Dism.DismApi] | ||
|
||
function ATA($Mnt, $Log = [NullString]::Value, $Tmp = [NullString]::Value, $Stub = 0) { | ||
|
||
try | ||
{ | ||
$Dism::InitializeEx(2, $Log, $Tmp) | ||
$sesn = $Dism::OpenOfflineSession($Mnt) | ||
$lst = [IO.File]::ReadAllLines('AppsToAdd.txt', [Text.Encoding]::ASCII) | ||
} | ||
catch | ||
{ | ||
Write-Host -Fore Red -Back Black $_.Exception.Message | ||
return | ||
} | ||
|
||
[bool]$bError = $FALSE | ||
|
||
ForEach ($itm in $lst) | ||
{ | ||
$drc = [IO.Path]::GetDirectoryName($itm) | ||
|
||
if ($drc.Equals('MSIXFramework', 'OrdinalIgnoreCase')) | ||
{ | ||
Write-Host ([IO.Path]::GetFileNameWithoutExtension($itm)) | ||
try | ||
{ | ||
$Dism::AddProvisionedAppxPackage($sesn, $itm, $null, $null, $null) | ||
} | ||
catch | ||
{ | ||
Write-Host -Fore Red -Back Black $_.Exception.Message | ||
$bError = $TRUE | ||
break | ||
} | ||
continue | ||
} | ||
|
||
Write-Host ($drc) | ||
[bool]$isStub = ([IO.Directory]::Exists($drc + '\AppxMetadata\Stub')) -and ([IO.Directory]::GetFiles($drc + '\AppxMetadata\Stub').Length -gt 0) | ||
if ($isStub) | ||
{ | ||
$stb = 2 | ||
if ($Stub -ne 0) {$stb = 1} | ||
} | ||
else | ||
{ | ||
$stb = 0 | ||
} | ||
try | ||
{ | ||
$Dism::AddProvisionedAppxPackage($sesn, $itm, $null, $null, $drc + '\License.xml', $null, 'all', $stb) | ||
} | ||
catch | ||
{ | ||
Write-Host -Fore Red -Back Black $_.Exception.Message | ||
$bError = $TRUE | ||
break | ||
} | ||
} | ||
|
||
if ($bError) | ||
{ | ||
try {$Dism::CloseSession($sesn)} catch {} | ||
try {$Dism::CloseSession($sesn)} catch {} | ||
try {$sesn = $Dism::OpenOfflineSession($Mnt)} catch {} | ||
try {$Dism::CloseSession($sesn)} catch {} | ||
$Dism::Shutdown() | ||
} | ||
else | ||
{ | ||
$Dism::CloseSession($sesn) | ||
$Dism::Shutdown() | ||
} | ||
|
||
} | ||
:embed: |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.