# Add New Registry Key
$regHive='REGISTRY::HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
$keyname='NoAutoRebootWithLoggedOnUsers'
$value=1
Set-ItemProperty -Path $regHive -Name $keyname -value $value
# Validation
Get-ItemProperty $regHive -name $keyname
PS C:\WINDOWS\system32> Get-ItemProperty $regHive -name $keyname
NoAutoRebootWithLoggedOnUsers : 1
PSPath : Microsoft.PowerShell.Core\Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpd
ate\AU
PSParentPath : Microsoft.PowerShell.Core\Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpd
ate
PSChildName : AU
PSProvider : Microsoft.PowerShell.Core\Registry
Categories: