1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

macOSにPowerShellとPowerCLIをインストールする

Last updated at Posted at 2023-02-09

事の経緯

  • 私が普段使用しているmacOS(Ventura)上でESXi(vSphere Hypervisor)のカスタムイメージを作る必要性ができた
  • ESXiのカスタムイメージの作成にはPowerCLIが必要だが、PowerCLIはPowerShell上でしか動作しない
  • ということでmacOSにPowerShellとPowerCLIをインストールする

PowerShellとは

  • Microsoftが開発したCLI兼スクリプト言語
  • ざっくりとコマンドプロンプトの強化版
  • Windows 7以降では標準でインストールされている
  • 2016年にオープンソース化され、macOSやLinuxでもサポートされるようになった
  • ちなみにWindowsに標準でインストールされているWindows PowerShellとOSSとして公開されているPowerShell Coreは厳密には違い、前者でサポートされている機能が後者ではサポートされていないこともあるため注意

PowerCLIとは

PowerShellのインストール

# インストール
$ brew install --cask powershell

# バージョンの確認
$ pwsh -v
PowerShell 7.3.2

# PowerShellのシェルに入る
$ pwsh
PowerShell 7.3.2
PS /Users/username>

PowerCLIのインストール

# インストール
PS /Users/username> Install-Module VMware.PowerCLI -Scope CurrentUser

# VMware Customer Experience Improvement Programに参加しない
PS /Users/username> Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false

# インストールされたことを確認
PS /Users/username> Get-Module -Name VMware.PowerCLI -ListAvailable

    Directory: /Users/username/.local/share/powershell/Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Manifest   13.0.0.20…            VMware.PowerCLI                     Desk
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?