if you want to use @userid why you tried @username?

just try with:
Writevalue ("HKEY_LOCAL_MACHINE\system\currentcontrolset\services\lanmanserver\parameters", "srvcomment", "@userid", "REG_SZ")
_________________________
!

download KiXnet