-
Notifications
You must be signed in to change notification settings - Fork 0
MS_PowerShellCore
-
TOP > シェル > PowerShell
- PowerShell Core
- PowerShell ISE
- OSS でクロスプラットフォームの PowerShell
- モダンライフサイクルポリシーを採用
- ランタイムに .NET Core を採用
(元ページ未記載)
補足(名称の変遷と現在地): 「PowerShell Core」という呼称は
6.x 系での名称で、現在は使われていない。
Windows PowerShell PowerShell Core PowerShell バージョン ~ 5.1 6.x 7.x 以降 実行ファイル powershell.exepwsh.exepwsh.exeランタイム .NET Framework .NET Core .NET 対応 OS Windows のみ Windows / Linux / macOS 同左 開発 機能追加は終了(Windows 同梱) 終息 継続 7.0 で "Core" が外れたのは、.NET Core が
.NET 5 で "Core" を外したのと同じ流れである
(→ .NET Coreバージョンアップ)。重要なのは、Windows PowerShell 5.1 と PowerShell 7 は別物で、
同一マシンに共存するという点。
5.1 は Windows に同梱され続け、7 は別途インストールする。
補足(移行時の非互換): シェル(スクリプト)の移行でも
触れたとおり、5.1 で書いたスクリプトが 7 でそのまま動くとは限らない。
実務で当たりやすいものを挙げておく。
Get-WmiObjectが削除された
→Get-CimInstanceに置き換える
(→ サーバ更改(バージョン・アップ移行))。- PSSnapin が廃止された
→ 古い製品の管理コマンドが読み込めない。- 既定のエンコーディングが UTF-8(BOM なし)になった
→ 5.1 は BOM 付き UTF-16 や Shift_JIS だったため、
ファイル出力の文字化けとして顕在化しやすい。- 一部の Windows 専用モジュールが動かない
→ 互換性のためImport-Module -UseWindowsPowerShellで
5.1 側にプロキシして呼び出せる(WindowsCompatibility)。- PowerShell ISE は 7 に付属しない
→ 編集環境は Visual Studio Code へ移る。逆に言えば、Windows 専用の運用スクリプトを 5.1 のまま使い続ける判断も
現実的である。Windows PowerShell 5.1 は
OS のライフサイクルに従ってサポートされるため、
VB6の保守 の VB6 ランタイムと似た位置づけにある。
補足(クロスプラットフォームであることの意味): Linux / macOS でも動くため、
- コンテナの中で使える
(mcr.microsoft.com/powershellイメージが提供されている)- CI / CD のスクリプトを OS 共通にできる
(GitHub Actions のshell: pwshなど)- Azure の管理(Az モジュール)をどの OS からでも行える
といった使い方ができる。
ただし、Linux 上では レジストリ や
COM、WMI といった Windows 固有の機能は当然使えない。
-
PowerShell Core:Dev Basics/Keyword - @IT
http://www.atmarkit.co.jp/ait/articles/1801/16/news026.html -
Windowsユーザーに贈るLinux超入門(38) | マイナビニュース
- WindowsもLinuxもPowerShell 7、入り組んだPowerShell事情を整理
https://news.mynavi.jp/article/liunx_win-38/
- WindowsもLinuxもPowerShell 7、入り組んだPowerShell事情を整理
-
PowerShell Core 6 の入門メモ - Qiita
https://qiita.com/rubytomato@github/items/988885d3e9860239ab88 -
「PowerShell Core」をざっくり理解する。 | 4thsight.xyz
https://4thsight.xyz/8638 -
PowerShell CoreからPowerShell 7に至る道
https://www.slideshare.net/stknohg/powershell-corepowershell-7
PowerShell Core入門 - 基本コマンドの使い方|連載一覧|開発ソフトウェア|解説/事例記事
https://news.mynavi.jp/itsearch/series/devsoft/powershell_core_-.html
-
PowerShell スクリプト
https://docs.microsoft.com/ja-jp/powershell/scripting/overview -
への PowerShell Core のインストール
- Windows
https://docs.microsoft.com/ja-jp/powershell/scripting/install/installing-powershell-on-windows - Linux
https://docs.microsoft.com/ja-jp/powershell/scripting/install/installing-powershell-on-linux - macOS
https://docs.microsoft.com/ja-jp/powershell/scripting/install/installing-powershell-on-macos - ARM
https://docs.microsoft.com/ja-jp/powershell/scripting/install/powershell-core-on-arm
- Windows
移行メモ: 上記インストール手順の URL は、
製品名から "Core" が外れたことに伴い
installing-powershell-core-on-*からinstalling-powershell-on-*に
変更されているため、現在の URL に修正した(ARM 版を除く)。
補足(現在のインストール方法): Windows では、
winget から導入するのが簡単である。winget install Microsoft.PowerShell
Tags: シェル, インフラストラクチャ, Windows, クラウド, Azure
このWikiは「Open棟梁Project」,「OSSコンソーシアム 開発基盤部会」によって運営されています。