Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in /home/r5652521/public_html/soma-engineering.com/wp-content/themes/affinger/functions.php on line 1548
Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in /home/r5652521/public_html/soma-engineering.com/wp-content/themes/affinger/functions.php on line 1548
Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in /home/r5652521/public_html/soma-engineering.com/wp-content/themes/affinger/functions.php on line 1548
Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in /home/r5652521/public_html/soma-engineering.com/wp-content/themes/affinger/functions.php on line 1548
Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in /home/r5652521/public_html/soma-engineering.com/wp-content/themes/affinger/functions.php on line 1548
Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in /home/r5652521/public_html/soma-engineering.com/wp-content/themes/affinger/functions.php on line 1548
Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in /home/r5652521/public_html/soma-engineering.com/wp-content/themes/affinger/functions.php on line 1548
こんにちは!SE ブログの相馬です。
今回は、PowerShell を使ってGPO の [サイトとゾーンの割り当て一覧] にURL を追加する方法について書きました。
私たちは日々、インターネットやイントラネットにあるホームページにアクセスしますが、サイト)は正しく動作しなかったりする場合があります。
そういった場合、IE で対象のサイトやサーバーを信頼済みサイトに追加しなければならない場合があるかと思います。
一般的には、IE の信頼済みサイトは GUI から手動で登録しますが、企業の場合は構成管理上の点でどの PC にも信頼済みサイトには同一のサイトや IP アドレスが入っている事が必要だと思いますので、そういった場合はグループポリシーを使って適用します。
具体的には GPO の中に、サイトとゾーンの割り当てという項目があり、そこに信頼済みサイトを追加してあげるといった方法になります。
IE から信頼済みサイトを追加する場合
ちなみに 一旦信頼済みサイトの追加をグループポリシーで適用されると、手動で追加できなくなります。
ただし、上記の方法で行うと一度に大量のサイトを信頼済みサイトに追加するのは時間がかかりますし、また入力ミスが発生するかもしれません。
個々にサイトを追加する分には良いのですが、大量のサイトを追加する場合は PowerShell で一度で追加できます。
それでは始めてみましょう。
事前準備
追加した信頼済みサイトを適用する為にはまず、[ユーザーの構成]-[ポリシー]-[管理用テンプレート]-[Windowsコンポーネント]-[Internet Explorer]-[インターネットコントロールパネル]-[セキュリティページ] をクリックして、[サイトとゾーンの割り当て一覧] の設定を有効にする必要があります。
取得する場合
GPO の [サイトとゾーンの割り当て一覧] に設定されているサイトを取得するには Get-GPRegistryValue コマンドレットを使います。
Get-GPRegistry
サイトを追加する前に、既に設定が入っている場合はまずこのコマンドレットで一覧を取得しましょう。
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Get-GPRegistryValue -Name "信頼済みサイト" -Key "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey" # 実行結果 KeyPath : Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey FullKeyPath : HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey Hive : CurrentUser PolicyState : Set Value : 2 Type : String ValueName : google.com ... |
追加する場合
Set-GPRegistryValue コマンドレットを使います。サイト毎にコマンドレットを追加する形になりますので、サイトの数だけコマンドレットの行が増える形になります。
Set-GPRegistry
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Set-GPRegistryValue -Name "信頼済みサイト" -Key "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey" -Type String -ValueName yahoo.com -Value 2 # 実行結果 DisplayName : 信頼済みサイト DomainName : soma-engineering.local Owner : SOMAENG\Domain Admins Id : 6560558b-c890-45f9-87c4-631f8e3e93b7 GpoStatus : AllSettingsEnabled Description : CreationTime : 2018/11/22 7:04:14 ModificationTime : 2018/11/23 12:51:10 UserVersion : AD Version: 10, SysVol Version: 10 ComputerVersion : AD Version: 0, SysVol Version: 0 WmiFilter : |
削除する場合
Remove-GPRegistryValue コマンドレットを使います。
Remove-GPRegistry
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Remove-GPRegistryValue -Name "信頼済みサイト" -Key "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey" -ValueName yahoo.com #実行結果 DisplayName : 信頼済みサイト DomainName : soma-engineering.local Owner : SOMAENG\Domain Admins Id : 6560558b-c890-45f9-87c4-631f8e3e93b7 GpoStatus : AllSettingsEnabled Description : CreationTime : 2018/11/22 7:04:14 ModificationTime : 2018/11/23 13:41:18 UserVersion : AD Version: 11, SysVol Version: 11 ComputerVersion : AD Version: 0, SysVol Version: 0 WmiFilter : |
レジストリの場所
ちなみに IE から手動で追加した場合と、グループポリシーから追加した場合、レジストリは同じ場所に追加されるのでしょうか?
答えは No で、それぞれ異なる場所に格納されます。
IE から追加した場合のレジストリは以下の場所に格納されます。
1 |
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains |
グループポリシー から追加した場合のレジストリは上とは異なる場所に格納されます。
1 |
HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains |
まとめ
以上になります。いかがでしょうか。
企業の場合は、信頼済みサイトの管理は必要で、一般的には GPO で 1 つ 1 つ手動で追加しますが大量のサイトや IP を追加する場合は時間がかかるので、そういった場合に PowerShell を使うと役に立ちます。
それでは最後までお読みいただきありがとうございました!