0

I try to set local group policy using PowerShell. My goal is to enable

Disable changing home page settings

Below is the PowerShell script:

# 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

The registry keys both get created. However, when I check the "gpedit.msc" the setting still remains to disable and nothing was configured.

Thanks

0

As expected, you need additional tools. If you run procmon during the change it'll show you the actual registry key which is under a GUID that I haven't found a way to resolve programmatically.

HKCU\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects\{<GUID>}User\Software\Policies\Microsoft\Internet Explorer\Main\Start Page

Also, if you check the registry.pol you'll see the entry, but you won't be able to edit it directly.

gc C:\Windows\System32\GroupPolicy\User\Registry.pol -Encoding Unicode
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.