Here's what I did:
I created the following value in my NT registry:

HKEY_CURRENT_USER\Autom\Test, type REG_SZ, initial value 1

I then ran this code:

code:
$counter = 12
writevalue("HKEY_CURRENT_USER\Autom","Test","$Counter","REG_SZ")
exit

The value changed to 12

I don't know why you are getting different results

_________________________
Box
FACTA NON VERBA