Add Registry Key using Powershell

Roger Roger 4,951 Reputation points
2021-03-15T09:10:54.217+00:00

Hi Experts

i have the below requirement on few servers.
create Folder i.e Key in registries by name FEATURE_ALLOW_USER32_EXCEPTION_HANDLER_HARDENING under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl and under this key
i want create a DWORD (32-bit) Value iexplore.exe with hexadecimal value data= 1
Experts guide me how to do this via PowerShell

I need to add key and add DWORD (32-bit) with hexadecimal value data= 1. Below is my requirement.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ALLOW_USER32_EXCEPTION_HANDLER_HARDENING\iexplore.exe with value 1
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ALLOW_USER32_EXCEPTION_HANDLER_HARDENING\iexplore.exe with value 1

Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,451 questions
Windows Server 2016
Windows Server 2016
A Microsoft server operating system that supports enterprise-level management updated to data storage.
2,368 questions
Windows Server 2012
Windows Server 2012
A Microsoft server operating system that supports enterprise-level management, data storage, applications, and communications.
1,526 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,108 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,359 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,491 Reputation points Microsoft Vendor
    2021-03-15T11:41:06.287+00:00

    Hi @Roger Roger ,

    To add new registry entry you can use the New-ItemProperty cmdlet

    $path1 = 'HKLM:\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ALLOW_USER32_EXCEPTION_HANDLER_HARDENING'  
    $path2 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ALLOW_USER32_EXCEPTION_HANDLER_HARDENING'  
    New-item -Path $path1  
    New-ItemProperty -Path $path1 -Name 'iexplorer.exe' -Value 1 -PropertyType DWord  
    New-item -Path $path2  
    New-ItemProperty -Path $path2 -Name 'iexplorer.exe' -Value 1 -PropertyType DWord  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    3 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Andy 1 Reputation point
    2021-03-15T09:14:30.087+00:00
    0 comments No comments