🐨

最新バージョンの PnP PowerShell のインストールについて

2022/03/01に公開

はじめに

この記事では、PnP PowerShell のインストール手順について説明します。
PnP PowerShell は、バージョンによってサポートされる Windows PowerShell のバージョンが異なります。

PnP PowerShell 2.xx 系は、Windows PowerShell 7.2 以上で動作します。
そのため、Windows PowerShell 5.1 の場合は、1.xx 系の PnP PowerShell を明示的にしてインストールを行う必要があります。

バージョンについての説明は、github 上の PnP PowerShell のページに記載があります。

https://github.com/pnp/powershell

PnP PowerShell のインストール方法

Windows PowerShell 7.2 以上を利用しているユーザーは、以下のコマンドを実行することで、安定版の最新バージョンの PnP PowerShell をインストールし、利用することができます。

PowerShell を管理者として実行し、コマンドを実行します。

Install-Module -Name "PnP.PowerShell"

メジャーリリースの最新バージョンへの上書きインストールは、以下のコマンドを実行します。

Install-Module -Name "PnP.PowerShell"  -Force

Nightly ビルドの最新版をインストールする場合は以下のコマンドを実行します。

Install-Module -Name "PnP.PowerShell" -AllowPrerelease

Windows PowerShell 5.1 を利用しているユーザーは、最初の説明の通り、最新の 2.xx 系を利用できないため、以下のように 1.xx 系のバージョンを指定して、インストールを行うが必要があります。

Install-Module -Name "PnP.PowerShell"  -RequiredVersion 1.12.0 

その他のバージョンのインストールについては、下記の PowerShell ギャラリーの内容を参考にバージョンを指定したインストールを行うことができます。
https://www.powershellgallery.com/packages/PnP.PowerShell/

インストールの詳細とインストール後の設定の詳細は、下記の記事に記載されています。

https://pnp.github.io/powershell/articles/installation.html

https://pnp.github.io/powershell/articles/authentication.html

従来のバージョンの PnP PowerShell (SharePointPnPPowerShellOnline) について

PnP PowerShell には、従来のバージョンの PnP PowerShell (SharePointPnPPowerShellOnline) があります。

以下のコマンドからインストールが可能ですが、こちらのバージョンに関しては、今後メンテナンスの予定はなく、現在はアーカイブの状況とのことです。
また、コミュニティでもサポートが提供されないため、上述の最新の PnP PowerShell の利用が強く推奨されるものと思います。

Install-Module -Name "SharePointPnPPowerShellOnline" 

https://github.com/pnp/PnP-PowerShell

PnP-PowerShell Repository - ARCHIVED Important: PnP-PowerShell has been retired and archived. Move to the new PnP PowerShell module available at https://github.com/pnp/powershell. We will only maintain that version going forward.

従来バージョンの PnP PowerShell (SharePointPnPPowerShellOnline) から、最新の PnP PowerShell (PnP.PoweShell) へのアップグレードの手順やバージョン変更の詳細ついては、以下の記事にまとまっていますので必要に応じて、バージョンアップを検討してもよろしいと思います。

https://pnp.github.io/powershell/articles/upgrading.html

Discussion