0
0

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.

リモートディスクトップからPCのWiFiパスワードを変更する

Posted at

背景

在宅勤務から社内WiFiのパスワードを変更した場合に接続テストを行うスクリプトです。

WiFiのパスワードはリモートから変更することは可能ですが、正しく動作しているか確認する場合は現地確認が必要になります。正しく動作していない場合は多くの人に影響するために設定を変更した後に自分で確認をします。

事前準備:

  1. 会社に有線でリモートディスクトップができ、WiFi接続も可能なWindowsPCを用意する
  2. そのPCに管理者権限で実行できる次のスクリプトを作成して置く

ファイル名:update_whi_wifi_password.ps1

netsh wlan set profileparameter name="wifi1" keyMaterial="<new_password>" # wifiのパスワードを変更
disable-netadapter -name "イーサネット" -Confirm:$false # 有線接続を無効にする
netsh wlan connect name="wifi1" # wifi接続を有効にする
start-sleep -Seconds 60 # 1分待つ
enable-netadapter -name "イーサネット" -Confirm:$false # 有線接続を行う。Wifi接続ができない場合は再びリモートディスクトップできるようにして置く

Wifi接続の確認

  1. 在宅から会社に置いてあるPCにリモートディスクトップ接続する
  2. コマンドプロンプトを開き、次を実行する
set-executionpolicy remotesigned
& "C:\wifi\script\update_whi_wifi_password.ps1"

その他

WiFiのパスワードを変更する場合は次のコマンドも便利です。

  • Wifiプロフィール一覧の表示
netsh wlan show profiles
  • SSIDパスワードの表示
netsh wlan show profile name="wifi1" key="clear"
  • ネットワークアダプタ一覧の表示
get-netadapter

以上

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?