目次
文書の過去の版を表示しています。
PowerShell(Linux)
PowerShell - Windows
本家: PowerShell Documentation | Microsoft Docs
ソースコード: GitHub - PowerShell/PowerShell: PowerShell for every system!
インストール
Releases · PowerShell/PowerShell
https://aka.ms/pscore6
https://aka.ms/pscore6-docs
https://aka.ms/powershell
Fedora - dnf
Fedora への PowerShell のインストール - PowerShell | Microsoft Docs
Red Hat Enterprise Linux (RHEL) への PowerShell のインストール - PowerShell
# Register the Microsoft RedHat repository curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo # Install PowerShell sudo dnf install --assumeyes powershell # Start PowerShell pwsh
$ curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 192 100 192 0 0 303 0 --:--:-- --:--:-- --:--:-- 303 [packages-microsoft-com-prod] name=packages-microsoft-com-prod baseurl=https://packages.microsoft.com/rhel/8/prod/ enabled=1 gpgcheck=1 gpgkey=https://packages.microsoft.com/keys/microsoft.asc
$ sudo dnf install --assumeyes powershell
packages-microsoft-com-prod 1.2 MB/s | 6.0 MB 00:05 メタデータの期限切れの最終確認: 0:00:07 時間前の 2023年03月12日 15時03分44秒 に実施しました。 依存関係が解決しました。 ============================================================================================================== パッケージ アーキテクチャー バージョン リポジトリー サイズ ============================================================================================================== インストール: powershell x86_64 7.3.3-1.rh packages-microsoft-com-prod 68 M トランザクションの概要 ============================================================================================================== インストール 1 パッケージ ダウンロードサイズの合計: 68 M インストール後のサイズ: 192 M パッケージのダウンロード: powershell-7.3.3-1.rh.x86_64.rpm 1.9 MB/s | 68 MB 00:35 -------------------------------------------------------------------------------------------------------------- 合計 1.9 MB/s | 68 MB 00:35 トランザクションの確認を実行中 トランザクションの確認に成功しました。 トランザクションのテストを実行中 トランザクションのテストに成功しました。 トランザクションを実行中 準備 : 1/1 インストール中 : powershell-7.3.3-1.rh.x86_64 1/1 scriptletの実行中: powershell-7.3.3-1.rh.x86_64 1/1 検証 : powershell-7.3.3-1.rh.x86_64 1/1 インストール済み: powershell-7.3.3-1.rh.x86_64 完了しました!
PowerShell の実行
$ pwsh
Release Candidate 版の場合
$ pwsh-preview
PowerShell のバージョン
$ Get-Host
Name : ConsoleHost Version : 7.3.3 InstanceId : a9548033-3e56-4aec-8c28-1d33694cdde3 UI : System.Management.Automation.Internal.Host.InternalHostUserInterface CurrentCulture : ja-JP CurrentUICulture : ja-JP PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy DebuggerEnabled : True IsRunspacePushed : False Runspace : System.Management.Automation.Runspaces.LocalRunspace
$ Get-Host | Select-Object Version
Version ------- 7.3.3
$ $PSVersiontable
Name Value ---- ----- PSVersion 7.3.3 PSEdition Core GitCommitId 7.3.3 OS Linux 6.1.15-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Mar 3 17:29:44 UTC 2… Platform Unix PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0