//Create the key if it does not exist
If (-NOT (Test-Path $RegistryPath)) {
New-Item -Path $RegistryPath -Force | Out-Null
}
New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType String -Force
HKEY_CURRENT_USER doesn’t make sense in the context of an action running as the LocalSystem account.
You either need to use ‘override’ commands to run the action in the context of the user, or change to path with a relevance expression like {user key of current user}\Software\...
You could probably manage this with 1 line of actionscript, using the info provided by @cmcannady and @JasonWalker
regset64 "[{user key of logged on user as string & "\SOFTWARE\Policies\Microsoft\Edge\3rdparty\extensions\abc\policy"}]" "userId"="{name of logged on user}"
You may want to do extra checks in case of systems that do not have a user logged in, or maybe have more than 1 logged in user as those would encounter relevance substitution errors. I used logged on user as this handles remote desktop connection sessions.