PowerShell Previewを確認画面なしでインストール・アンインストールし、展開ツールで検出するためのコマンドです。マニフェストの記載か、インストーラー技術の既定値として確実なコマンドだけを表示しています。
関連ガイド: サイレントインストールのオプション一覧 · レジストリとPowerShellでアンインストールする方法
wingetを使う
PowerShell
winget install --id Microsoft.PowerShell.Preview -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Microsoft.PowerShell.Preview -e --silentwinget uninstall --id Microsoft.PowerShell.Preview -e --silentインストーラー別
64ビット · MSIX
サイレントインストール
Add-AppxPackage -Path PowerShellPreview-7.7.0-preview.5.msixbundleアンインストール
Get-AppxPackage -Name Microsoft.PowerShellPreview | Remove-AppxPackageARM64 · MSIX
サイレントインストール
Add-AppxPackage -Path PowerShellPreview-7.7.0-preview.5.msixbundleアンインストール
Get-AppxPackage -Name Microsoft.PowerShellPreview | Remove-AppxPackage32ビット · MSIX
サイレントインストール
Add-AppxPackage -Path PowerShellPreview-7.7.0-preview.5.msixbundleアンインストール
Get-AppxPackage -Name Microsoft.PowerShellPreview | Remove-AppxPackagePowerShell:ダウンロード・検証・インストール
公式ファイルをダウンロードし、SHA256を検証してからサイレントインストールします。
install-powershell-preview.ps1
$url = 'https://github.com/PowerShell/PowerShell/releases/download/v7.7.0-preview.5/PowerShellPreview-7.7.0-preview.5.msixbundle'
$sha256 = 'A7F88673E17F064F8E5A21B1A2A98DC142ACAAB20AFADD8212934BD4CB2DC0C3'
$file = Join-Path $env:TEMP 'PowerShellPreview-7.7.0-preview.5.msixbundle'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Add-AppxPackage -Path $file install-powershell-preview.ps1
$url = 'https://github.com/PowerShell/PowerShell/releases/download/v7.7.0-preview.5/PowerShellPreview-7.7.0-preview.5.msixbundle'
$sha256 = 'A7F88673E17F064F8E5A21B1A2A98DC142ACAAB20AFADD8212934BD4CB2DC0C3'
$file = Join-Path $env:TEMP 'PowerShellPreview-7.7.0-preview.5.msixbundle'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Add-AppxPackage -Path $file install-powershell-preview.ps1
$url = 'https://github.com/PowerShell/PowerShell/releases/download/v7.7.0-preview.5/PowerShellPreview-7.7.0-preview.5.msixbundle'
$sha256 = 'A7F88673E17F064F8E5A21B1A2A98DC142ACAAB20AFADD8212934BD4CB2DC0C3'
$file = Join-Path $env:TEMP 'PowerShellPreview-7.7.0-preview.5.msixbundle'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Add-AppxPackage -Path $file