📌

Msixbundleファイルをインストールする (PowerShellスクリプト)

2021/10/16に公開

MsixbundleファイルをインストールするPowerShellスクリプトです。

function global:Install-App-Msixbundle([string] $uri) {
	if ([string]::IsNullOrEmpty($uri)) {
		Write-Error -Message "Invalid Uri" -ErrorAction Stop
		return 1603
	}

	[string] $filePath = Join-Path $Env:Temp ([Guid]::NewGuid().ToString() + ".msixbundle")
	Invoke-WebRequest -Uri $uri -OutFile $filePath -UseBasicParsing
	if ((-not (Test-Path $filePath)) -or ((Get-Item $filePath).Length -eq 0)) {
		return 1603
	}
	Add-AppxPackage -Path $filePath
	Remove-Item $filePath

	return 0
}

Discussion