仅在 Windows 7 上使用 IE 8 测试:
> 让所有用户从 HKLM 而不是 HKCU 读取安全设置:
PS> Set-HKLM-Only # (-disable)
> 将“google.com”设为 Intranet 站点:
PS> Set-Zone -URL "google.com" -ZoneLevel 1 # (-1 从列表中删除)
Function Set-HKLM-Only {
param(
[switch]$disable
)
if($disable) {
Remove-ItemProperty -Path "$regIEpolSettings" -Name "Security_HKLM_Only" -Force
} else {
New-ItemProperty -Path "$regIEpolSettings" -Name "Security_HKLM_Only" -Value 1 -PropertyType dword -Force
}
}
Function Set-Zone {
param(
[parameter(mandatory=$true)]
[string] $URL,
[ValidateRange(-1,4)]
[parameter(
mandatory=$true,
HelpMessage="-1 = Remove from zonelist , 0 = This Machine , 1 = Local Intranet , 2 = Trusted Sites , 3 = Internet , 4 = Restricted Sites"
)]
[int] $ZoneLevel
)
if($ZoneLevel -lt 0) {
Remove-Item -Path "$regIEpolSettings\ZoneMap\Domains\$URL" -Force
} else {
New-Item -Path "$regIEpolSettings\ZoneMap\Domains\$URL" -Force
New-ItemProperty -Path "$regIEpolSettings\ZoneMap\Domains\$URL" -Name '*' -Value $ZoneLevel -PropertyType dword -Force
}
}
New-Variable -Scope Script -Name regIEpolSettings -Value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" -Force
/米