Wouldn't it just be the number and not hex?

$regkey = "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\AutoUpdate"
$=WriteValue( $regkey, "AUState",2, "REG_DWORD" )