1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PowerShellでFirefoxやChromeをWindowsにインストール

Last updated at Posted at 2025-02-05

本ブログは、オラクル・クラウドの個人ブログ一覧の1つです。

初めに
このブログでは、PowerShellスクリプトを活用して、FirefoxChromeの自動インストールを実現する方法を解説します。特に、クラウド環境での効率的なセットアップを目指す方や、Computeインスタンスの作成時にブラウザを自動的にインストールしたい方にとって役立つ内容となっています。

cloud-initスクリプトに組み込むことで、インスタンスの初期設定時にブラウザを自動的にインストールできるため、手作業によるインストールの手間を省き、環境構築のスピードを大幅に向上させることが可能です。

動作確認済環境
Windows Server 2019 Standard (OCI VM)
Windows 11

目次

Firefoxのインストール

ステップ

  • インストーラのダウンロード
  • インストール開始(サイレントモード)
  • インストーラの削除(オプション)
#ps1_sysnative

# Define the URL of the browser installer
$DownloadURL = "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=en-US"
$InstallerFile = Join-Path $env:TEMP "Firefox_Installer.exe"

# Download the Firefox installer
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $DownloadURL -OutFile $InstallerFile

# Unblock the downloaded file
Unblock-File -Path $InstallerFile

# Install Firefox silently
Start-Process -Wait -FilePath $InstallerFile -Args "/S"

# Clean up the installer (optional)
Remove-Item $InstallerFile

上記のダウンロードリンクは英語版です。日本語版のリンクは次となります。
https://download.mozilla.org/?product=firefox-latest&os=win64&lang=ja

Chromeのインストール

ステップは上記と同じで、インストーラURLとファイル名以外の違いは、次です。
インストール・パラメータ:/silent /install

#ps1_sysnative

# Define the URL of the browser installer
$DownloadURL = "https://dl.google.com/chrome/install/latest/chrome_installer.exe"
$InstallerFile = Join-Path $env:TEMP "ChromeSetup.exe"

# Download the Chrome installer
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $DownloadURL -OutFile $InstallerFile

# Unblock the downloaded file
Unblock-File -Path $InstallerFile

# Install Chrome silently
Start-Process -Wait -FilePath $InstallerFile -Args "/silent /install"

# Clean up the installer (optional)
Remove-Item $InstallerFile

※、上記のインストーラー(chrome_installer.exe)は多言語対応で、システムのデフォルト言語で自動的にChromeをインストールします。

OCI cloud-initスクリプトで使用する場合は、スクリプトの先頭に#ps1_sysnativeを追加する必要があります。

以上

関連記事
OCI Cloud-initスクリプト

1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?