Add Registry Key using Powershell

Roger Roger 7,181 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 for business Windows Server User experience PowerShell
Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    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.

    4 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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.