Invoke HKCURegistry Settings For AllUsers not applying

I had a look at previous posts but they do not apply in my case. I’m am trying to set a registry key for all users to null or leave it blank

[scriptblock]$HKCURegistrySettings = {
Set-RegistryKey -Key ‘HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings’ -Name ‘AutoConfigURL’ -Value “’’” -Type String -ContinueOnError:$True -SID $UserProfile.SID
}
Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings
As per the script, I need the Vale for AutoConfigURL to be empty. the script is running but not updating the existing value. I have tried using just single quotes and just double quotes without any luck
At the moment it has 2 single quotes inside 2 double quotes

ok, hopefully I dont get shot for this but


before I learned about this tool I was using this to write to the HKCU.
to run: cscript.exe scriptname.vbs /B
I have not used the one for this tool yet.

Try this, it worked for me.

$HKCURegistrySettings = {
Set-RegistryKey -Key ‘HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings’ -Name ‘AutoConfigURL’ -Value ‘’ -Type String -ContinueOnError:$True -SID $UserProfile.SID
}
Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings