if you execute the script with administrator rights, try the following code :
 Code:
$regkey = "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\AutoUpdate"
$=WriteValue( $regkey, "AUState", 0x00000002, "REG_DWORD" )

If you write "0x00000002", this a string.
So when WriteValue convert it to integer because of REG_DWORD, the result is 0.
I don't think this is what you want.
_________________________
Christophe