Netwrix 1Secureは、データとアイデンティティ全体にわたる統合された可視性を提供します。14日間の無料トライアルでフルアクセス可能です。無料トライアルを開始

リソースセンターブログ

PowerShell 7 をダウンロードしてインストール

PowerShell 7 をダウンロードしてインストール

Aug 25, 2025

PowerShell 7 は .NET Core をベースにしたクロスプラットフォームの自動化フレームワークで、パフォーマンスの向上、並列処理、そして Windows PowerShell モジュールとの幅広い互換性を提供します。Windows、macOS、Linux、コンテナー上で動作し、パッケージマネージャー、MSI、ZIP、Docker など柔軟なインストール方法に対応しています。Long-Term Support 版はエンタープライズ向けの安定性を提供し、プレビルドでは新機能をいち早く利用できます。

PowerShell 7 の概要

PowerShell 7 は、Windows PowerShell の機能を基にした最新のクロスプラットフォーム(Windows、macOS、および Linux)向けの自動化および構成管理ツールです。これは、Windows 専用の .NET Framework に依存していた従来の PowerShell のバージョンとは異なり、.NET Core ランタイムに基づいています。この切り替えにより、互換性、パフォーマンス、汎用性が大幅に向上しました。

PowerShell 7 には、次の追加機能と強化点があります:

  • PowerShell 7 では ForEach-Object -Parallel, が導入され、複数の項目を並列パイプラインで処理できるようになっています。これにより、並列化可能なワークロードの実行時間が大幅に短縮されます。
  • Get-Help のようなコマンドの更新を含む新しい cmdlet と API により、スクリプト環境はより充実し、より多用途になります。
  • 新しい -ErrorAction および -ErrorVariable オプションにより、スクリプト内でのエラー処理をより適切に制御できます。
  • PowerShell 7 には Windows Compatibility Layer(Windows 互換レイヤー)が含まれており、Windows PowerShell 用に作成されたほとんどのモジュール(例: Active Directory や Exchange モジュール)が、暗黙のリモーティング(implicit remoting)を使用して Windows ベースの環境で実行できるようになります。
  • PowerShell 7 は Windows PowerShell と併存してインストールできるため、既存のワークフローを中断せずに段階的な移行が可能です。多くのレガシー スクリプトも最小限の変更で実行できます。すべての古いモジュールがネイティブに動作するわけではありませんが、互換レイヤーによって大幅な対応が確保されます。
  • PowerShell 7 は PowerShell 拡張機能を介して Visual Studio Code とシームレスに統合され、IntelliSense、デバッグ、統合テストなどの機能を利用できます。
  • 最後に、PowerShell 7 はオープンソースプロジェクトとして GitHub で開発・保守されています。

Windows PowerShell と PowerShell 7 の違いについては、Check, Update, and Choose a PowerShell Version の記事をご覧ください。

Active Directory のセキュリティに関するベストプラクティス

詳しく知る

PowerShell 7 をダウンロード

PowerShell 7 をダウンロードする前に、利用可能なバージョンとその違いを把握しておく必要があります。

利用可能な PowerShell 7 のバージョン

Microsoft は PowerShell 7 に対して 3 種類のリリースを提供しています。

安定版リリースは、運用環境で使用できる準備が整っていると見なされる PowerShell の一般提供(General Availability)バージョンです。LTS(Long-Term Support)として指定されていない限り、これらのバージョンは 18 か月間サポートされます。

安定版リリース

最新の安定版リリース:PowerShell 7.4.6(2024 年 10 月 22 日リリース)。このバージョンは .NET 8.0 をベースにしており、Long-Term Support(LTS)リリースとして指定されています。サポートは 2026 年 11 月まで延長されます。

LTS(Long-Term Support)リリース

LTS バージョンは、非 LTS リリースに比べてより長い期間(3 年)サポートされます。これらは、長期的な安定性と互換性が重要となる企業や環境を想定して設計されています。

現在の LTS リリース:PowerShell 7.4(2026 年 11 月までサポート)

プレビュ―リリース

プレビュー リリースでは、新機能や更新プログラムにいち早くアクセスできます。これらはテストやフィードバックを目的としていますが、本番環境での使用は推奨されません。プレビュー版が確定すると、Stable リリースになります。

最新のプレビューリリース:PowerShell 7.5 Release Candidate 1(RC-1)。2024年11月18日に発表されました。このバージョンは .NET 9 をベースに構築されており、「go-live」リリースと見なされるため、運用環境での使用がサポートされます。PowerShell 7.5 は、18か月の標準的なサポートライフサイクルに従います。

バージョンのタイムラインとサポート概要

Version

Release Type

Support Ends

.NET Version

Notes

7.4

LTS

November 2026

.NET 8

Current LTS version

7.5 RC-1

Preview

N/A (Preview)

.NET 9

Next stable candidate

7.2

LTS (Ended)

November 8, 2024

.NET 6

Previous LTS version

7.0

LTS (Ended)

February 2022

.NET Core 3.1

First LTS version

どのバージョンを使うべきですか?

  • 本番環境で長期的な安定性が必要な場合は、LTS を選択してください。
  • 本番環境の準備状況を維持しながら新機能にアクセスしたい場合は、Stable を使用してください。
  • Explore Preview を使用して、今後予定されている機能をテストし、フィードバックを提供してください。

PowerShell 7 のダウンロードリンクはどこで見つけられますか?

PowerShell 7 のダウンロードリンクは、Microsoft の Web サイト、公式の PowerShell GitHub リポジトリ、およびその他の検証済みソースで確認できます。

Microsoft の Web サイト

URL: Windows、Linux、macOS に PowerShell をインストールする

以下のプラットフォームに PowerShell をインストールする手順が含まれています:

  • Windows:MSI インストーラー、Microsoft Store
  • macOS:.pkg ファイル、Homebrew
  • Linux:.tar.gz ファイル、apt、yum、dnf などのネイティブなパッケージマネージャー

公式 PowerShell GitHub リリース ページ

URL:PowerShell のリリース

GitHub のリリースページでは、以下のダウンロード リンクが提供されます。

  • 安定版
  • LTS 版
  • プレビュー リリース

希望するバージョンを選択し、オペレーティング システム(Windows、macOS、Linux)用のインストーラー パッケージをダウンロードしてください。

直接パッケージマネージャー

  • Windows – Microsoft Store からインストールして自動更新を有効にする
  • macOS – Homebrew からインストール
  • Linux – お使いのディストリビューションのパッケージ マネージャーを使用(例:apt、yum、dnf、zypper)

Winget パッケージマネージャー

Windows パッケージ マネージャー(winget)を使用して Windows システムに PowerShell の最新バージョンをインストールするには、次のコマンドを使用します。

      winget install --id Microsoft.PowerShell --source winget
      

Docker イメージ

URL:Docker Hub

PowerShell 7 は、事前にビルドされた Docker イメージとして利用できます。最新の LTS 版または安定版リリースを取得(pull)できます。

PowerShell 7 のインストール方法

PowerShell 7 は、各プラットフォームに合わせたさまざまな方法で Windows、macOS、Linux にインストールできます。

Windows へのインストール

  • シンプルなインストール手順を希望するユーザーには、Microsoft Store が最適です。さらに、自動更新も提供されます。
  • PowerShell GitHub Releases ページからダウンロードする MSI インストーラーは、対話型のインストールをサポートしており、PowerShell をシステムの PATH に追加するオプションも用意されています。
  • Winget パッケージ マネージャーは、スクリプトベースのデプロイと自動化に最適です。
  • GitHub からダウンロードした ZIP パッケージには、PowerShell のポータブル版が含まれています。管理者権限がない環境での使用や、テストに役立ちます。
  • PowerShell を .NET Global ツールとしてインストールするのは、他のグローバル ツールをインストールして使用する .NET 開発者にとって引き続き良い選択です。

macOS へのインストール

  • Homebrew は自動更新と macOS ツールとの連携により、macOS ユーザーにおすすめです。
  • PowerShell の GitHub Releases ページからダウンロードしたインストーラーパッケージ(.pkg)は、対話的なインストール体験を提供します。

Linux へのインストール

  • Ubuntu/Debian や openSUSE など、使用しているディストリビューションのパッケージマネージャーを使って PowerShell をインストールします。
  • Tarball アーカイブはポータブルなインストールを提供します。GitHub から .tar.gz ファイルをダウンロードできます。

どの方法があなたに最適ですか?

PowerShell 7 のインストール方法の選択は、使用しているプラットフォームと要件に応じて決まります。

Environment

Recommended Method

Windows Desktop

Microsoft Store or MSI Installer

Windows Server

MSI Installer or ZIP Package

macOS

Homebrew or .pkg Installer

Linux (Desktop)

Native Package Manager

Linux (Server)

Native Package Manager or Docker

Containerized Apps

Docker Images

Portable Needs

ZIP Package (Windows) or Tarball (Linux/macOS)

Developers

Build from Source

追加のヒントは次のとおりです:

  • 簡単に導入でき、自動更新も行えるため、Microsoft Store または Homebrew を利用してください。
  • 管理者権限がない場合は、ポータブル版(ZIP または Tarball)を使用してください。
  • 構成管理ツールとの統合をよりスムーズに行うため、Windows では MSI インストーラーを選択し、Linux ではネイティブのパッケージマネージャーを使用してください。
  • Dockerは、開発やテスト環境を含む、隔離された環境と再現可能なセットアップに最適です。
  • PowerShell に貢献する上級ユーザーや開発者は、PowerShell の GitHub リポジトリをクローンし、ソースからビルドできます。

Windowsに PowerShell 7 をインストールする

Windows パッケージ マネージャー(Winget)を使用する

Windows パッケージ マネージャー(Winget)は、Windows 上に PowerShell 7 をインストールするためのシンプルで効率的な方法です。Windows クライアントに PowerShell をインストールする際の推奨手段です。

前提条件

  • Winget は Windows 11 および Windows 10 の新しいバージョンにあらかじめインストールされています。利用できない場合は、Microsoft Store の App Installer パッケージからインストールしてください。
  • Winget はコマンド プロンプトまたは PowerShell から実行できます。
  • 管理者として Winget を実行すると、権限の問題なくインストールが進みます。

Winget を使って PowerShell 7 をインストールする手順

  1. コマンド プロンプト または PowerShell のいずれかを起動します。
  2. パッケージ ID を使用して PowerShell の最新バージョンをインストールします:

winget install –id Microsoft.PowerShell –source winget

特定のバージョンをインストールするには、–version フラグを指定します:

winget install –id Microsoft.PowerShell –version 7.4.6

Microsoft Store からインストール

Microsoft Store から PowerShell をインストールすることで、いくつかの利点があります。

  • 自動更新が行われます。
  • インストール手順がスムーズで、Windows ともうまく統合されます。
  • 信頼できる安全な提供元を利用できるため、侵害された、または非公式のバージョンをダウンロードしてしまうリスクが低減されます。

Microsoft Store から PowerShell 7 をインストールする手順

  1. Microsoft Store を開くには、Windows + S を押して Microsoft Store と入力し、Enter キーを押します。
  2. Microsoft Store の検索バーに PowerShell 7 と入力し、Enter キーを押します。
  3. 検索結果で PowerShell を探します(PowerShell 7 または最新バージョンに言及していることを確認してください)。そのために、下へスクロールして「Additional Information」または「App Details」セクションに移動し、そこでバージョン番号を確認します。
  4. 「Get」または「Install」ボタンをクリックして PowerShell をインストールします。Microsoft Store にサインインしていない場合は、Microsoft アカウントでサインインする必要があることがあります。

MSI パッケージを使って PowerShell をインストール

MSI パッケージを使って PowerShell をインストールする方法は、管理された再現性のあるインストールが不可欠な企業環境やその他の環境で特に有利です。これにより、Windows サーバーやエンタープライズ展開のシナリオにおける推奨手段となります。

  • MSI パッケージは集中管理された展開を提供し、IT 管理者は Group Policy、System Center Configuration Manager (SCCM)、またはその他のエンタープライズ ソフトウェア展開ツールを使って複数のマシンに展開できます。
  • さらに、すべてのシステムに同じ PowerShell のバージョンが一貫してインストールされることも保証します。
  • MSI パッケージではオフライン インストールが可能です。
  • インストール中、MSI パッケージでは、インストールパスや PowerShell をシステムパスに追加するなどの設定を構成するためのオプションが用意されているため、特定のニーズに合わせてインストールを簡単に調整できます。

MSI パッケージを使って PowerShell 7 をインストールする手順

  1. 次の PowerShell GitHub releases page にアクセスします。
  2. 最新の PowerShell 7 リリースを探し、下にスクロールして Assets セクションまで移動します。
  3. お使いのシステムに合った MSI ファイルをダウンロードしてください:
  4. 64 ビット システム用 PowerShell-x64.msi
  5. 32 ビット システム用 PowerShell-x86.msi
  6. ダウンロードした .msi ファイルをシステム内で見つけます(通常は Downloads フォルダー)。インストーラーを実行するには、それをダブルクリックしてください。画面の指示に従って PowerShell をインストールします。

ZIP パッケージのインストール

PowerShell をカスタム インストールするには ZIP アーカイブを使用します。この方法は、インストーラーやパッケージ マネージャーを利用できない環境に対して柔軟でシンプルです。また、複数のバージョンをインストールするのに最も簡単な方法でもあり、Windows Nano Server、Windows IoT、Arm ベースのシステムでは引き続き推奨される方法です。

  1. 次のページへ移動してください: PowerShell GitHub releases page
  2. 最新の PowerShell 7 リリースを見つけて、Assets セクションまで下にスクロールしてください。
  3. システムに合った適切な ZIP パッケージをダウンロードしてください:
  4. 64 ビット システム向け win-x64.zip
  5. 32 ビット システム向け win-x86.zip
  6. ZIPファイルをダウンロードしたフォルダーに移動し、その内容をディレクトリに解凍します。
  7. System PATH に PowerShell を追加します。
  8. コントロール パネルを開き、System > Advanced system settings > Environment Variables に移動します。
  9. システム変数の下で Path 変数を見つけて、[編集]をクリックします。
  10. [新規]をクリックし、PowerShell を解凍したディレクトリのパスを追加します(例: C:\PowerShell\pwsh)。
  11. [OK]をクリックして保存し、ダイアログ ボックスを閉じます。

PowerShell 7 を実行するには、新しいコマンド プロンプトまたは PowerShell ウィンドウを開きます。次に「pwsh」と入力して Enter を押すと、PowerShell が起動します。

.NET グローバル ツールとしてインストール

すでに .NET Core SDK がインストール済みの場合、PowerShell を .NET グローバル ツールとしてインストールできます。

dotnet tool install –global PowerShell

dotnet ツールのインストーラーは、$HOME\.dotnet\tools を $env:PATH 環境変数に追加します。

コマンドラインでのサイレント インストール

PowerShell のサイレント インストールは、企業環境での自動化された展開に最適です。

コマンドラインで PowerShell 7 をサイレント インストールする手順

  1. 「MSI パッケージを使って PowerShell をインストールする」セクションで説明しているとおり、MSI インストーラーをダウンロードします。
  2. 管理者権限でコマンド プロンプトを開きます。これには、コマンド プロンプトを右クリックして「管理者として実行」を選択します。
  3. 次のコマンドを使用して PowerShell をサイレント インストールします。:
      msiexec /i PowerShell-x64.msi /quiet /norestart
      

例:MSI が[ダウンロード]フォルダーにある場合

      msiexec /i "%UserProfile%\Downloads\PowerShell-x64.msi" /quiet /norestart
      

このコマンドでは:

  • /i はインストールを指定します
  • /quiet は UI を表示せずにインストーラーを実行します
  • /norestart は、インストール後にシステムが自動的に再起動するのを防ぎます

自動展開のための高度なコマンドライン インストール

PowerShell を高度なコマンドラインでサイレント インストールするには、管理者が追加の構成オプションを活用して、企業環境での自動展開を促進できます。以下にいくつかの例を示します。

  • 以下のように INSTALLFOLDER プロパティを使用してカスタムのインストール パスを指定します。
    msiexec /i PowerShell-x64.msi /quiet /norestart INSTALLFOLDER=”C:\CustomPath\PowerShell7″
  • 以下のように、ファイル エクスプローラーにコンテキスト メニューを追加します。
    msiexec /i PowerShell-x64.msi /quiet /norestart ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=true
  • 以下のように、PowerShell をシステム PATH から除外します。
    msiexec /i PowerShell-x64.msi /quiet /norestart DO_NOT_ADD_TO_PATH=true
  • 以下のように、Windows Server Update Services (WSUS) を通じて自動更新を有効にします。
    msiexec /i PowerShell-x64.msi /quiet /norestart ENABLE_MU=true
  • 大規模な展開(デプロイ)用に、バッチ ファイルまたは PowerShell スクリプトを作成します。

初心者向け Windows PowerShell スクリプト入門(PDF)

詳しく知る

Install PowerShell 7 on macOS

You can install PowerShell on macOS using the following methods:

  • Using Homebrew
  • Downloading Installer Package (.pkg)
  • Installing as a .NET Global tool
  • ZIP アーカイブの使用

macOS に PowerShell をインストールする前に、インストール要件とサポートされている macOS のバージョンを確認しましょう。

サポートされている macOS のバージョン

Microsoft は、PowerShell がサポート終了(end-of-support)に達するか、または macOS のバージョンがサポート終了に達するまで PowerShell をサポートします。現在サポートされているバージョンは次のとおりです:

  • macOS 15(Sequoia)x64 と Arm64
  • macOS 14(Sonoma)x64 および Arm64
  • macOS 13(Ventura)x64 および Arm64

次のコマンドを使用して、macOS のバージョンを確認してください:

sw_vers -productVersion

システム要件

システム要件は次のとおりです:

Processor

Intel-based MacApple Silicon (M1/M2) is supported via Rosetta 2 or native ARM64 binaries (introduced in later releases of PowerShell 7)

Disk Space

At least 100 MB of free disk space for installation

Prerequisites

HomebrewAlternatively, use the .pkg installer from the GitHub release page

.NET Runtime

PowerShell 7 relies on the cross-platform .NET Core runtime. The required runtime is bundled with the PowerShell package, so no separate installation is required.

Apple Silicon (M1/M2) Considerations

PowerShell supports native execution on Apple Silicon starting with PowerShell 7.2. If using an earlier version, Rosetta 2 must be installed.

Homebrew を使用して PowerShell をインストールする

Homebrew は macOS 向けの人気のパッケージマネージャーで、PowerShell のインストールと更新を簡単に行えます。

Homebrew を使って PowerShell をインストールするには、次のコマンドを実行します:

      brew install --cask powershell
      

または、次の cmdlet を使用して PowerShell の LTS バージョンをインストールします:

      brew install powershell/tap/powershell-lts
      

GitHub からパッケージをダウンロード

Microsoft は PowerShell 用の署名済み .pkg インストーラーを提供しています。これを使用して PowerShell をインストールする方法は、手動のインストール手順を好むユーザーに適しています。

  1. 次の PowerShell GitHub releases page に移動します。
  2. 最新の PowerShell 7 のリリースを見つけて、下にスクロールして Assets セクションに移動します。
  3. macOS 用の .pkg インストーラーをダウンロードします。
  4. ダウンロードした .pkg ファイルをダブルクリックして、PowerShell のインストールを開始します。

.NET Global ツールとしてインストール

この方法では .NET Core SDK を使用して PowerShell をインストールします。

  1. Homebrew を使って .NET SDK をダウンロードしてインストールします:
      brew install --cask dotnet-sdk
      
  • .NET Core CLI を使って PowerShell をグローバル ツールとしてインストールします:
      dotnet tool install --global PowerShell
      

dotnet ツール インストーラーは ~/.dotnet/tools を PATH 環境変数に追加します。--global を指定すると PowerShell をグローバルにインストールできるため、システム全体で利用できます。

ZIP アーカイブを使ってインストールする

この方法はあまり一般的ではありませんが、カスタム設定に利用できます。

  1. PowerShell GitHub releases page」に移動します。
  2. 最新の PowerShell 7 リリースを探し、Assets(アセット)セクションまでスクロールします。
  3. macOS 用の ZIP ファイルをダウンロードします。通常は次のような名前です:powershell-7.x.x-osx-x64.tar.gz。
  4. ZIP ファイルをディレクトリに展開します。
  5. 次のコマンドを使用して、pwsh バイナリを実行可能にします:
      chmod +x ~/powershell/pwsh
      
  • そのディレクトリを $PATH に追加するか、すでに $PATH に含まれているディレクトリ内に pwsh へのシンボリックリンクを作成します:
      ln -s ~/powershell/pwsh /usr/local/bin/pwsh
      
  • 最後に、pwsh cmdlet を使用して PowerShell を実行できます。

Linux に PowerShell 7 をインストールする

PowerShell は幅広い Linux ディストリビューションでサポートされており、多様な環境で利用できます。以下の表は、PowerShell をインストールするために公式にサポートされているディストリビューションを示しています。

Distribution

Versions

Package Type

Notes

Ubuntu

20.04, 22.04

.deb

Widely supported and tested. Uses the official Microsoft APT repository.

Debian

10, 11

.deb

Installable via the Microsoft APT repository.

CentOS

7, 8 Stream

.rpm

Red Hat-derived. Available via the Microsoft YUM repository.

RHEL

7, 8, 9

.rpm

Supported using YUM or DNF from the Microsoft repository. Requires enabling “Optional” and “Extras” repos on RHEL 7.

Fedora

37, 38

.rpm

Supported via YUM/DNF repositories.

Alpine

3.15+

Binary tar.gz

PowerShell for Alpine is available but may require additional steps due to differences in libraries (for example, glibc compatibility).

Arch Linux

Rolling Release

AUR

Supported unofficially via the Arch User Repository (AUR).

Kali Linux

Rolling Release

.deb

Installed via the Microsoft APT repository, similar to Debian/Ubuntu.

Linux の標準的なインストール方法

Linux に PowerShell 7 をインストールする標準的な方法は次のとおりです:

  • パッケージマネージャー(APT、YUM、DNF)– Debian/Ubuntu では、Microsoft APT リポジトリの .deb パッケージを使用します。RHEL/CentOS/Fedora では、Microsoft YUM リポジトリの .rpm パッケージを使用します。
  • バイナリーアーカイブのインストール — Alpine Linux のようなディストリビューションやカスタム環境では、次の PowerShell GitHub リリース から .tar.gz アーカイブを使用してください。

パッケージマネージャーでインストール

APT(Ubuntu/Debian)

  1. 開始する前に、次のコマンドを使用してシステムのパッケージリストを更新します:
      sudo apt update

sudo apt upgrade -y
      
  • 次のコマンドを使用して前提条件をインストールします:
      sudo apt install -y wget apt-transport-https software-properties-common
      
  • 次のコマンドを使用して Microsoft の GPG キーをインポートし、リポジトリを登録してください:
      wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb

sudo dpkg -i packages-microsoft-prod.deb
      
  • 次のコマンドを使用して PowerShell をインストールしてください:
      sudo apt-get update

sudo apt-get install -y powershell
      

YUM/DNF (CentOS/RHEL/Fedora)

  1. 次のコマンドを使用して Microsoft の GPG キーをインポートし、リポジトリを追加してください:
      sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
      
  • このコマンドを使用して PowerShel をインストールしてください:
      sudo yum install -y powershell
      

Alpine Linux

  1. 次のコマンドを使用して必要な依存関係をインストールします:
      apk add --no-cache bash icu-libs less curl
      
  • 次のコマンドを使用して PowerShell をダウンロードして展開します:
      wget https://github.com/PowerShell/PowerShell/releases/download/v<version>/powershell-<version>-linux-alpine-x64.tar.gz

mkdir ~/powershell

tar -xzf powershell-<version>-linux-alpine-x64.tar.gz -C ~/powershell
      
  • 次に、下の例のようにディレクトリに移動して PowerShell のバイナリを実行することで、PowerShell を起動できます:
      ~/powershell/pwsh
      

バイナリアーカイブ(tar.gz)を使用してインストール

この .tar.gz アーカイブは持ち運び可能で、ほぼあらゆる Linux システムで動作します。

  1. PowerShell GitHub releases page」へ移動し、アーキテクチャ(x64 または ARM64)に対応した tar.gz ファイルをダウンロードしてください。例のコマンドは次のとおりです:
      wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.0/powershell-7.4.0-linux-x64.tar.gz
      
  • 次のコマンドでアーカイブを展開します:
      mkdir ~/powershell

tar -xzf powershell-7.4.0-linux-x64.tar.gz -C ~/powershell
      
  • 次のコマンドで PowerShell を実行します:
      ~/powershell/pwsh
      

コミュニティおよび代替のインストールオプション

Linux に PowerShell をインストールするその他の方法は次のとおりです。

  • Docker コンテナー — Linux ディストリビューション向けの公式 PowerShell Docker イメージを使用します。
  • 手動ビルド — 未サポートのディストリビューションやカスタム ディストリビューションの場合は、PowerShell をソースからビルドできますが、専門知識と時間が必要です。

Docker を使用してインストール

PowerShell には、Linux ディストリビューションをサポートする Microsoft Container Registry (MCR) で公開されている公式 Docker イメージがあります。

  1. 次のコマンドを使用して PowerShell イメージを取得します:
      docker pull mcr.microsoft.com/powershell
      
  • コンテナ内で対話型 PowerShell セッションを起動するには、次のコマンドを使用します:
      docker run -it mcr.microsoft.com/powershell
      

Linux 上の PowerShell に対する ARM 対応

PowerShell は ARM ベースの Linux システム(特に ARM64 アーキテクチャ)をサポートしています。ARM 対応のディストリビューションは次のとおりです:

  • Ubuntu 20.04、22.04(ARM64)
  • Debian 11 (ARM64)
  • RHEL 8/9 (ARM64)
  • Alpine 3.15+ (ARM64)

ARM(Ubuntu の例)で PowerShell をインストールするには、次の手順を実行します。

  1. 次のコマンドを使用して PowerShell GitHub releases page から ARM64 の .deb パッケージをダウンロードします。
      wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.0/powershell_7.4.0-1.deb_arm64.deb
      
  • 次のコマンドを使用してパッケージをインストールします:
      sudo dpkg -i powershell_7.4.0-1.deb_arm64.deb
      

ソースからインストール

サポートされていない、または高度にカスタマイズされた Linux 環境の場合は、ソースコードから PowerShell をビルドできます。

  1. 次のコマンドを使用して PowerShell リポジトリをクローンします:
      git clone https://github.com/PowerShell/PowerShell.git

cd PowerShell
      
  • 依存関係をインストールします(ディストリビューションによって異なります)。
  • 次の方法で PowerShell をビルドします:
      ./build.sh -c Release
      

ここで -c Release は、ビルド構成が「Release」(本番向けに最適化)であることを指定します。

  • 生成された pwsh バイナリは out/ ディレクトリ(./out/linux-x64/)に配置されます。
  • PowerShell をインストールするには:
  • PowerShell 用のディレクトリを作成します(例:/usr/local/bin/powershell)。
      sudo mkdir -p /usr/local/bin/powershell

sudo cp -r ./out/linux-x64/* /usr/local/bin/powershell/
      
  • シンボリックリンクを作成して、pwsh をグローバルに利用できるようにします:
      sudo ln -s /usr/local/bin/powershell/pwsh /usr/bin/pwsh
      

PowerShell 7 の実行と使用

PowerShell 7 を起動

Windows、macOS、Linux では、PowerShell 7 を起動する方法がいくつかあります。

Windows の場合

Method

Steps


Start Menu

Press the Windows key or click the Start Menu.Type pwsh and press Enter.

Run Dialog

Press Win + R to open the Run dialog.Type pwsh and click OK.

Command Prompt or Windows PowerShell

Open Command Prompt (cmd) or Windows PowerShell.Type pwsh and press Enter.

Desktop Shortcut

Create a shortcut pointing to the pwsh.exe executable (typically found in C:\Program Files\PowerShell\7\pwsh.exe).Double-click the shortcut to open PowerShell 7.

Context Menu

Right-click on an empty space in a folder while holding Shift.Select Open PowerShell window here (if configured).

Taskbar or Start Pin

Locate PowerShell 7 in the Start Menu.Right-click and choose Pin to Start or Pin to Taskbar for easy access.

macOS の場合

Method

Steps

Terminal

Open the built-in Terminal app.Type pwsh and press Return.

Spotlight Search

Press Cmd + Space to open Spotlight.Type pwsh and press Return.

Finder

Navigate to the folder where PowerShell 7 is installed (for example, /usr/local/bin if installed via Homebrew).Double-click or run it from the Terminal.

Homebrew (if installed via Homebrew)

Use the command: brew list | grep powershell

Linux の場合

Method

Steps

Terminal

Open a terminal.Type pwsh and press Enter.

Application Menu

Depending on your desktop environment (for example, GNOME, KDE), search for “PowerShell” in the application menu.

Desktop Shortcut

Create a desktop shortcut to the pwsh executable (typically located in /usr/bin/pwsh or /opt/microsoft/powershell/7/pwsh).

Run Command

Use the Alt + F2 (GNOME) or Super + R (KDE) run command dialog.Type pwsh and press Enter.

Script or Cron Job

Add pwsh to your scripts or scheduled tasks for automation.

基本コマンドの使い方とヒント

これから始めるための基本的なコマンドの使い方とヒントです。

基本コマンドの構文

Item

Syntax

Cmdlets

PowerShell uses cmdlets (pronounced “command-lets”) with the structure: Verb-Noun -ParameterName Value An example is: Set-Item -Path “C:\test.txt” -Value “Hello”

Pipelines

Use the pipe | to send the output of one cmdlet as input to another. Here is an example: Get-Process | Where-Object { $_.CPU -gt 100 }

基本コマンド

Task

Command

Find Help

To get help for a cmdlet: Get-Help Get-Process
To view examples: Get-Help Get-Process-Examples

Navigate the File System

List directory contents: Get-ChildItem
Change directory: Set-Location C:\Path
Create a new directory: New-Item -ItemType Directory -Path C:\NewFolder

Manage Files

Create a new file: New-Item -ItemType File -Path C:\test.txt
Read file content: Get-Content C:\test.txt
Write to a file: Set-Content -Path C:\test.txt -Value “Hello, World!”

View System Information

Check system processes: Get-Process View running services: Get-Service
Get system information: Get-ComputerInfo

Scripting Basics

Run a script: .\script.ps1
Variables: $name = “PowerShell”
Write-Output “Hello, $name!”

Package Management

Install a module: Install-Module -Name Az -Scope CurrentUser
Import a module: Import-Module Az
List installed modules: Get-InstalledModule

効率的な使い方のコツ

オートコンプリート

Tab キーを使用して、cmdlet、パラメーター、またはファイル パスを自動補完します。

エイリアス

PowerShell は、以下のように cmdlet のショートカットをサポートしています。

      dir      # Alias for Get-ChildItem

cd       # Alias for Set-Location

cls      # Alias for Clear-Host
      

すべての alias を表示するには、次の cmdlet を使用します。

      Get-Alias
      

スクリプト内のコメント

  • 単一行コメントは次のとおりです。
      # This is a comment
      
  • 複数行コメントは次のとおりです。
      <#

This is a multi-line comment

#>
      

エラー処理

try-catch ブロックはエラー処理に最適です。例は次のとおりです:

      Try {

    Get-Item "C:\nonexistent.txt"

} Catch {

    Write-Host "An error occurred: $_"

}
      

出力の書式設定

  • 次の cmdlet を使用して、出力をテーブルとして書式設定します:
      Get-Process | Format-Table
      
  • 次の cmdlet を使用して、出力をリストとして書式設定します:
      Get-Process | Format-List
      

クロスプラットフォームのヒント

  • Windows 以外のシステムでも、ls や cat のようなネイティブのシェルコマンドをそのまま使用できます。
  • pwsh -WindowsCompatibility モードを使用して、特定の Windows 専用モジュールを呼び出します。

PowerShell 7 を最新の状態に保つ

インストール方法に基づいて更新オプションを選択

Windows で PowerShell を更新する

PowerShell の当初のインストール方法に応じて、Winget、Microsoft Store、または MSI インストーラーを使用して更新できます。

Method


Description


Winget

Winget doesn’t automatically update installed applications, but you can manually update PowerShell. Open PowerShell as an administrator and run the following command: winget upgrade –id Microsoft.PowerShell –source winget Here, –source winget forces the command to only use the winget source repository when finding the PowerShell package. This ensures that the package is not sourced from other repositories you might have added to winget, such as third-party repositories or custom sources.

Microsoft Store

Open the Microsoft Store and type “PowerShell” in the search bar to search for PowerShell. Select the “PowerShell” application. If an update is available, the Update button will appear. Click it to update PowerShell.

MSI installer

Download the appropriate MSI file for your system architecture from the PowerShell GitHub releases page. Double-click the downloaded MSI file and follow the on-screen instructions to update PowerShell. Restart PowerShell when the update completes.

macOS で PowerShell を更新する

PowerShell の当初のインストール方法に応じて、macOS ではいくつかの方法で PowerShell を更新できます。

Method

Description

Homebrew

Update Homebrew to ensure it has the latest package information using the following cmdlet: brew update Run the following command to upgrade PowerShell: brew upgrade powershell

Manual Download (GitHub)

Download the .pkg file for the latest version of PowerShell from the PowerShell GitHub releases page. Double-click the downloaded .pkg file and follow the on-screen instructions to update PowerShell.

.NET Tool

Make sure the .NET CLI is installed. Then use the following command to update PowerShell: dotnet tool update –global PowerShell

Linux で PowerShell を更新する

Linux で PowerShell を更新する方法は、どのようにインストールされたかによって異なります。

Method

Description

Package Manager

For APT-based Systems (Ubuntu, Debian) Update the Package List: sudo apt update Update PowerShell: sudo apt upgrade powershell For DNF-based Systems (Fedora, CentOS, RHEL) Update the Package Repository: sudo dnf check-update Update PowerShell: sudo dnf upgrade powershell

Manual Download (GitHub)

Download the latest package for PowerShell as appropriate to your Linux distribution (for example, .deb, .rpm, or binary .tar.gz) from the PowerShell GitHub releases page. Uninstall the previous PowerShell version and then use the following cmdlets to install the new version. For APT-based systems sudo dpkg -i powershell-<version>.deb For DNF-based systems sudo rpm -Uvh powershell-<version>.rpm For binary .tar.gz tar -xvf powershell-<version>.tar.gz sudo mv pwsh /usr/local/bin

旧バージョンからアップグレード

PowerShell 5.1(Windows PowerShell)または PowerShell Core から最新の PowerShell 7+ バージョンへアップグレードするには、特定の手順と考慮事項が必要です。たとえば、既存のスクリプトが PowerShell 7+ で動作することを確認するためにテストし、$PROFILE に保存されているカスタムのプロファイルやスクリプトはバックアップしてください。

Windows PowerShell 5.1 からアップグレード

Windows PowerShell 5.1 は直接アップグレードできませんが、PowerShell 7+ と共存できます。

PowerShell Core(6.x)からアップグレード

PowerShell Core は PowerShell 7+ に直接アップグレードできます。

  1. PowerShell の GitHub リリースページ にアクセスし、お使いの OS に対応するパッケージをダウンロードしてください(例:Windows は .msi、Linux は .deb)。
  2. 新しいバージョンをインストールします。詳細については、該当するセクションをご覧ください:
  3. Windows に PowerShell 7 をインストールする
  4. macOS に PowerShell 7 をインストールする
  5. Linux に PowerShell 7 をインストールする

既定では、同じ場所にインストールされている場合、PowerShell 7+ は PowerShell Core のインストールを置き換えます。

PowerShell 7 のサポートと互換性

サポートされているオペレーティング システム

PowerShell 7 はクロスプラットフォームで、Windows、macOS、およびさまざまな Linux ディストリビューションで動作します。

Windows

Supported Versions

Windows 10 (x64 and ARM64) – Version 1607 or laterWindows 11 – All versionsWindows Server – 2012 R2 or later

Requirements

.NET Runtime – PowerShell 7 is built on .NET 6 or later. These runtimes are bundled with the PowerShell 7 installer for Windows.Disk Space – Approximately 150 MB for the base installationRAM – Minimum 1 GB; 2 GB or more is recommended

macOS

Supported Versions

macOS 10.13 High Sierra or later (64-bit)

Requirements

.NET Runtime – .NET 6 or later runtime is bundled with the PowerShell 7 package for macOSDisk Space – Approximately 150 MB for the installationRAM – Minimum 1 GB; 2 GB or more is recommended

Linux

Requirements

.NET Runtime – .NET 6 or later runtime is required. It is bundled in most PowerShell 7 packages or can be installed manually.Disk Space – Approximately 150 MB for the installationRAM – Minimum 1 GB; 2 GB or more is recommended

Supported Distributions

PowerShell 7 supports a wide range of Linux distributions. The most common ones are: Debian-based (APT package manager) Ubuntu 16.04 or later (64-bit) Debian 9 or later (64-bit) Red Hat-based (DNF/YUM package manager) CentOS 7 or later (64-bit) Red Hat Enterprise Linux (RHEL) 7 or later (64-bit) Fedora 30 or later (64-bit) SUSE-based (Zypper package manager) openSUSE 42.3 or later (64-bit) SUSE Linux Enterprise Server (SLES) 12 SP2 or later (64-bit) Other Alpine Linux 3.10 or later (64-bit) Arch Linux (community-maintained)

クロスプラットフォーム構成

Supported Hardware Architecture

x64ARM64 (for supported Windows and Linux distributions)

Compatibility Features

Windows-specific modules (for example, Active Directory, Exchange) are supported via the compatibility module (Enable-WindowsCompatibility) on Windows.Cross-platform remoting is supported using SSH or WinRM, depending on the platform.

コンテナのサポート

Docker Images

Official PowerShell Docker images are available for Linux, Windows, and ARM-based systems. Images are available for: Debian Ubuntu Alpine Windows Server Core

Requirements

Docker must be installed and configured.

サポートされていない構成

  • PowerShell 7 は 64 ビットのオペレーティング システムでのみサポートされ、32 ビットのオペレーティング システムはサポートされません。
  • PowerShell 7 は Windows 10 より前の Windows バージョンをサポートしていません。
  • 10.13 High Sierra より前の macOS バージョンはサポートされていません。
  • サポート終了(end-of-life)に達した Linux ディストリビューションは、公式にはサポートされていません。

Microsoft Update の統合

PowerShell 7 のアップデートは、Windows 上の Microsoft Update を通じて管理できます。これにより、ユーザーは他の Windows アップデートと一緒に自動でアップデートを受け取れます。

Microsoft Update 経由で PowerShell 7 のアップデートを行う方法

  • Microsoft Update — PowerShell 7 は、Microsoft Update(PowerShell を含む Microsoft ソフトウェア向けの更新プログラムを提供する任意のサービス)と統合されています。
  • 更新の種類 – 更新には、新しいバージョン、バグ修正、セキュリティパッチ、機能強化が含まれる場合があります。
  • 頻度 – 更新は、PowerShell の開発サイクルと重要なセキュリティ更新に基づいて、定期的にリリースされます。

Microsoft Update を有効にする

システムが Microsoft Update を使用するように設定されていることを確認してください。

  1. Windows Update に移動し、「詳細オプション」をクリックします。
  2. 「他の Microsoft 製品の更新を受け取る」でスイッチを「オン」に切り替えます。この設定により、Microsoft Update が PowerShell およびその他の Microsoft ソフトウェアの更新を確認できるようになります。

自動更新の設定

PowerShell の更新が自動的にインストールされるようにするには、Windows Update の設定を構成します。

  1. Windows Update に移動して「詳細オプション」をクリックします。
  2. 次の内容を設定します:
  3. 自動更新 – 更新を有効にして自動的にインストールする
  4. 稼働時間 – 稼働時間を設定して、勤務時間中の更新を防止する

Active Directory のグループ管理に関するベストプラクティス

詳しく知る

PowerShell 7 のインストール問題のトラブルシューティング

さまざまなプラットフォームに PowerShell 7 をインストールすると、環境要因や依存関係の問題などにより、まれにエラーが発生することがあります。ここでは、Windows、macOS、Linux 各プラットフォームでよくあるエラーとその対処法の一覧を示します。

Windows

  1. エラー: 実行ポリシーによりインストールができません

このエラーは、実行ポリシーが厳しすぎるために発生します。インストールを試行する前に、昇格した PowerShell セッションで次のコマンドを実行してください:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

  • エラー: 前提条件が不足しているためインストールできません

このエラーは .NET Core Runtime が見つからないために発生します。Microsoft’s .NET site から最新の .NET Core Runtime をダウンロードしてインストールし、その後 PowerShell のインストールを進めてください。

  • エラー:インストーラーには管理者権限が必要です

このエラーは管理者権限が不足しているために発生します。対処するには、インストーラーを右クリックして「管理者として実行」を選択してください。

MacOS

  1. エラー:zsh:コマンドが見つかりません:pwsh

このエラーは、PowerShell のバイナリがシステムの PATH に含まれていないために発生します。問題を解決するには、次のコマンドを実行してください:

echo ‘export PATH=”/usr/local/microsoft/powershell/7:$PATH”‘ >> ~/.zshrc

source ~/.zshrc

  • エラー:ダウンロードした .pkg ファイルをマウントできません

このエラーは、.pkg ファイルが破損しているために発生します。このファイルを削除し、公式サイト から再ダウンロードしてください。

  • エラー:インストールにはより新しいバージョンの macOS が必要です

このエラーは、macOS のバージョンが古すぎるために発生します。PowerShell 7 でサポートされているバージョンに macOS をアップグレードする必要があります。

  • エラー:インストール中に権限が拒否されました

このエラーは、管理者権限が不足しているために発生します。次のコマンドを使用して問題を解決してください:

sudo installer -pkg powershell-7.x.x.pkg -target /

Linux

  1. エラー: powershell パッケージを見つけられません

このエラーは、Microsoft リポジトリがパッケージ マネージャーに追加されていないために発生します。次のコマンドで追加してください:

# Ubuntu/Debian の例:

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb

sudo dpkg -i packages-microsoft-prod.deb

sudo apt-get update

  • エラー:依存関係がありません

このエラーは、libssl や curl のような依存関係がインストールされていないために発生します。不足している依存関係をインストールするには、次のコマンドを使用してください:

# Ubuntu の例:

sudo apt-get install -y libssl1.1 libcurl4

  • エラー:pwsh の実行中に権限が拒否されました

このエラーは、バイナリに対する権限が不足しているために発生します。問題を解決するには、次のコマンドを実行してください:

sudo chmod +x /usr/bin/pwsh

  • エラー:パッケージのバージョンがシステム アーキテクチャと互換性がありません

このエラーは、ダウンロードしたパッケージのアーキテクチャが不適切であることが原因です。たとえば x86 と ARM のような違いです。システムのアーキテクチャに合った正しいパッケージを official release page からダウンロードする必要があります。

インストールおよび実行時の問題を解決するためのヒント

ここでは、さまざまなプラットフォームで PowerShell 7 のインストールおよび実行時の問題をトラブルシューティングし、解決するための一般的なヒントを紹介します。

一般的なインストールのヒント

システム要件を確認する

  • OS のバージョンとアーキテクチャ(x86、x64、ARM)が PowerShell 7 をサポートしていることを確認してください。
  • .NET Core Runtime など、必要な依存関係がインストールされていることを確認してください。

公式ソースからダウンロード

PowerShell パッケージをダウンロードする際は、常に公式の PowerShell GitHub releases page か、お使いのプラットフォームで信頼できるリポジトリを利用してください。

インストールログを確認

失敗の詳細については、ログを確認してください:

  • Windows – C:\Windows\Temp か イベント ビューア
  • Linux/macOS – ターミナルのエラーメッセージまたはパッケージマネージャーのログ

パッケージマネージャーを更新する

インストールコマンドを実行する前に、パッケージマネージャー(例:apt、yum、brew)が最新であることを確認してください。

正しい PATH の設定を確認してください

インストール後、PATH 経由で PowerShell のバイナリにアクセスできることを確認してください。できない場合は、手動で追加します。

  • Windows – 環境変数を編集して C:\Program Files\PowerShell\7 を含めます
  • Linux/macOS – シェル設定に /usr/bin/pwsh または /usr/local/bin/pwsh を追加します

昇格した権限を使用します

管理者/スーパー ユーザー権限が必要なプラットフォームでは、次の手順を実行してください:

  • Windows – 管理者として実行
  • Linux/macOS – パッケージのインストールには sudo を使用

実行時の問題を解決するためのヒント

  • PowerShell がハングしたり挙動がおかしい場合は、プロファイル スクリプトをスキップしてください。
  • PowerShell と、インストール済みのすべてのモジュールが最新であることを確認してください。
  • 互換性の問題を特定するために、サードパーティ製モジュールやスクリプトを一時的に削除してください。
  • 詳細なエラーメッセージについて、システムログを調査してください。
  • リモートセッションまたはモジュールのインストールに関するエラーの場合は、インターネット接続と DNS 解決が正しく行われていることを確認してください。あわせて、ファイアウォールのルールとプロキシ設定も確認してください。
  • $PSModulePath や $env:PATH のような PowerShell 環境変数が正しく設定されていることを確認してください。

結論

この記事では、Windows、macOS、Linux を含むさまざまなプラットフォームで PowerShell 7 をインストールおよび更新するための方法を説明します。ユーザーのニーズに基づいて、PowerShell 7 をインストールするための追加のおすすめは次のとおりです:

初心者/日常ユーザー向け

  • Windows – MSI または Microsoft Store からインストール
  • macOS – .pkg インストーラーを使用
  • Linux – ネイティブのパッケージマネージャーでインストール

開発者 / パワーユーザー向け

  • パッケージマネージャー(Homebrew、apt、dnf)を使用して、効率的な更新とシステム統合を行ってください
  • クロスプラットフォームのスクリプトの場合は、同じディレクトリにインストールしてください(例: /usr/local/bin)

ポータブルインストールの場合、または管理者権限がない場合

  • Windows – ZIP アーカイブを使用
  • Linux/macOS – 手動インストールには tarball を使用

エンタープライズ環境向け

  • 集中管理された配布ツール(例:Group Policy、SCCM)を使用して PowerShell MSI ファイルを展開します
  • 複数のシステムにわたってインストールスクリプトを自動化

インターネットアクセスが制限された環境の場合:

  • オフライン インストーラー(MSI/PKG/Tarball)をダウンロードし、ローカルに配布します

以下のガイドラインに従うことで、さまざまな環境で PowerShell 7 の機能を最大限に活用できます。

  • $IsWindows、$IsLinux、$IsMacOS の自動変数を使って、プラットフォーム非依存のスクリプトを書きます。さらに、ハードコーディングを避けるために、環境固有のパスは変数に保存してください。
  • 効率化のために $PROFILE をカスタマイズします。
  • PowerShell Remoting を使用してリモート マシンを管理します。クロスプラットフォームの SSH リモーティングを有効にしていることを確認してください。
  • トラブルシューティングのために、内蔵のエラー処理を使用するとともに、詳細ログを有効にしてください。
  • 本番環境で使用するスクリプトには、必ず署名を付けてください。
  • PowerShell 7 は API と連携するのが得意なので、REST API と Web リクエストを使用してください。
  • PowerShell を Jenkins、Azure DevOps、GitHub Actions などの自動化ツールに統合してください。
  • モジュール化したスクリプトと再利用可能な関数を作成し、それらをモジュールとしてパッケージ化します。

Netwrix Directory Manager

よくある質問

共有する

もっと詳しく

著者について

Asset Not Found

Jonathan Blackwell

ソフトウェア開発責任者

2012年以降、エンジニアでありイノベーターである Jonathan Blackwell は、エンジニアリングのリーダーシップを通じて Netwrix GroupID を、Active Directory および Azure AD 環境におけるグループとユーザー管理の最前線に押し上げてきました。開発、マーケティング、営業での経験により、Jonathan は Identity 市場と買い手の考え方を深く理解できています。