Does it work better if you remove the leading backslash from the keyname in the function ?

$Key='HKLM\System\CurrentControlSet\Services\W3SVC\Parameters'

Hope this helps.

-Shawn