I am trying to test for 32 vs 64 bit and then create either one or two new keys depending upon the environment.
I would like to keep the code simple if I can and just set the Type, Name, Value, etc all at once if I can. Looking online it seems like it can be done, but whenever I try to run it, I just get prompted for a Type:
Looking for assistance / insight.
It seems pretty straightforward, here is what I am starting with:
$RegLocation1 = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_ALLOW_USER32_EXCEPTION_HANDLER_HARDENING\" $RegLocation2 = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ALLOW_USER32_EXCEPTION_HANDLER_HARDENING" If ([System.Environment]::Is32BitProcess) { New-Item -Path $RegLocation1 -Force New-ItemProperty -Path $RegLocation1 -Name "iexplore.exe" -Value 1 -ErrorAction SilentlyContinue -PropertyType DWord }Else { New-Item -Path $RegLocation1 -Force New-ItemProperty -Path $RegLocation1 -Name "iexplore.exe" -Value 1 -ErrorAction SilentlyContinue -PropertyType DWord New-Item -Path $RegLocation2 -Force New-ItemProperty -Path $RegLocation2 -Name "iexplore.exe" -Value 1 -ErrorAction SilentlyContinue -PropertyType DWord }
Subreddit
Post Details
- Posted
- 8 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/PowerShell/...