我尝试使用PowerShell设置本地组策略。我的目标是启用
禁用更改主页设置
以下是PowerShell脚本:
# Set the values as needed
$dchps_control_panel = "HKCU:\Software\Policies\Microsoft\Internet Explorer\Control Panel"
$dchps_main = "HKCU:\Software\Policies\Microsoft\Internet Explorer\Main"
$homepage = "HomePage"
$enabled = 1
$startpage = "Start Page"
$startpage_value = "www.google.com"
# Test if the Registry Key exists already
if(-not (Test-Path $dchps_control_panel) -or -not (Test-Path $dchps_main) )
{
# Create Control Panel Key to enable and Main Key
New-Item -Path $dchps_control_panel -Force
New-Item -Path $dchps_main -Force
}
# Enable Disable changing home page settings
Set-ItemProperty -Path $dchps_control_panel -Name $homepage -Value $enabled -Type DWord
#
# Set Start Page
Set-ItemProperty -Path $dchps_main -Name $startpage -Value $startpage_value -Type String
注册表项都已创建。但是,当我查看" gpedit.msc"该设置仍然有效,无法配置任何内容。
由于