Microsoft Store アプリケーションのインストール(Powershell スクリプト)
こんにちは
Microsoft Store アプリケーションなどをインストールする Powershell スクリプトを作りました1。下記の使用例は、サイト内から目的のパッケージファイルの uri を見つけ、指定して実行しています。
(1) Ubuntu 18.04
「Linux 用 Windows サブシステム ディストリビューション パッケージを手動でダウンロードする」 (docs.microsoft.com)
PS> .\Add-Package.ps1 -Uri https://aka.ms/wsl-ubuntu-1804
(2) Ubuntu 20.04
「Linux 用 Windows サブシステム ディストリビューション パッケージを手動でダウンロードする」 (docs.microsoft.com) (同上サイト)
PS> .\Add-Package.ps1 -Uri https://aka.ms/wslubuntu2004
(3) Windows Package Manager (a.k.a., winget)
「Windows Package Manager (latest release)」 (github.com/microsoft)
PS> .\Add-Package.ps1 -Uri https://github.com/microsoft/winget-cli/releases/download/v1.1.12653/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
(4) Microsoft Windows Terminal
「Windows Windows Terminal (latest release)」 (github.com/microsoft)
PS> .\Add-Package.ps1 -Uri https://github.com/microsoft/terminal/releases/download/v1.11.2921.0/Microsoft.WindowsTerminal_1.11.2921.0_8wekyb3d8bbwe.msixbundle
(5) Linux kernel update package
「Windows Subsystem for Linux Installation Guide for Windows 10」 (docs.microsoft.com)
PS> .\Add-Package.ps1 -Uri https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
(6) QL-Win/QuickLook
「QL-Win/QuickLook Latest release」 (GitHub)
PS> .\Add-Package.ps1 -Uri https://github.com/QL-Win/QuickLook/releases/download/3.7.0/QuickLook-3.7.0.msi
Powershell スクリプト
# Encoding::Shift-JIS
Param($Uri)
$ext = [IO.Path]::GetExtension($Uri)
If ($ext -eq "") {$ext = ".appx"}
$file_downloaded = "temporary_"+$ext
Invoke-WebRequest -Uri $Uri -OutFile $file_downloaded -UseBasicParsing
If ($ext -eq ".msi") {msiexec /i $file_downloaded}
else {Add-AppxPackage -Path $file_downloaded}
Remove-Item $file_downloaded
- なお前もって、PowerShell コマンドライン(管理者権限)上で ExecutionPolicy を設定し、スクリプトを実行可能とする必要があります:
PS> Set-ExecutionPolicy RemoteSigned
- なお
Invoke-Item
コマンドを使って、指定したテキストファイル(txt や ps1 ファイル)を「メモ帳」で開くことができます2:PS> Invoke-Item Add-Package.ps1
winget 利用によるインストール(別方法)
もしくは、Windows Package Manager (a.k.a., winget) をインストールし利用すると、各種パッケージをより簡素にインストール可能です:
PS> winget install Ubuntu
PS> winget install "Windows Terminal"
PS> winget install -e --id QL-Win.QuickLook
- 参考: winget.run (Finding winget packages made simple)
Author And Source
この問題について(Microsoft Store アプリケーションのインストール(Powershell スクリプト)), 我々は、より多くの情報をここで見つけました https://qiita.com/kkdd/items/8aead1424315199dc851著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .