0
0

More than 1 year has passed since last update.

PowerShellで「ネットワークとインターネット」のプロキシを設定する

Last updated at Posted at 2022-07-28

What's?

PowerShellで、「ネットワークとインターネット」のプロキシを設定してみたいなと。

環境

Windows Server 2022。

Get-ComputerInfo | select WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer

WindowsProductName                      WindowsVersion OsHardwareAbstractionLayer
------------------                      -------------- --------------------------
Windows Server 2022 Standard Evaluation 2009           10.0.20348.558

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.20348.643
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.20348.643
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

コマンド

プロキシを有効にする。

New-ItemProperty -LiteralPath "HKCU:Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name "ProxyEnable" -PropertyType "DWord" -Value "1" -Force

プロキシサーバーを設定する。

New-ItemProperty -LiteralPath "HKCU:Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name "ProxyServer" -PropertyType "String" -Value "[your-proxy-host]:[your-proxy-port]" -Force

プロキシ除外設定を行う。

New-ItemProperty -LiteralPath "HKCU:Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name "ProxyOverride" -PropertyType "String" -Value "<local>" -Force

現在値の確認

Get-ItemProperty -LiteralPath "HKCU:Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name "ProxyEnable"

Get-ItemProperty -LiteralPath "HKCU:Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name "ProxyServer"

Get-ItemProperty -LiteralPath "HKCU:Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name "ProxyOverride"
0
0
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
0
0