For a private preview tool provided by Microsoft, a registry value needs to be set to Type REG_DWORD value 46, then change the Base from hexadecimal to decimal. Here is a portion of the documentation I am referring to:
I am creating a Proactive remediation script to push out to a group of machines that need this Reg key/item for the preview tool to work.
$regkeyPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate"
$regEntry = "WUfBDF"
$desiredValue = 46
function createRegEntry($path, $entry, $value){
write-output "Remediating registry entry."
if(test-path -Path $path){
write-output "$path exists. Setting $entry"
Set-ItemProperty -Path $path -Name $entry -Value $value -Type DWord -force | out-null
}else{
New-Item -Path $Path -Force
New-ItemProperty -Path $path -Name $entry -Value $value -PropertyType DWord -force | out-null
}
}
createRegEntry $regkeyPath $regEntry $desiredValue
I read the Set-ItemProperty documentation here from Microsoft Documentation and it seems that when creating a REG-DWORD value its Base defaults to hex and has to manually be altered. Any way to change it to REG_DWORD with the Base as Decimal
The "base" option in the regedit UI is a convenience for the user. The instructions could just as easily have said "set base to Hexadecimal and enter 2e" - they're both the same number. Sometimes it's just easier to work with a hex number - e.g. 0xF000
(hex) instead of 61440
(decimal) or vice versa.
In fact, if you set the dialog to Decimal, enter 46 and then change to Hexadecimal you'll see the "Value data" change to 2e automatically...
And it shows both values in the main details pane:
Similarly, when writing your PowerShell code you could write $desiredValue = 46
or $desiredValue = 0x2E
and get the same result. They're both representations of the same number - one decimal and one hexadecimal - it just depends on your preference which format you use.