NTDOCNTDOC Administrator
Registered: 2000-07-28
Posts: 11634
Loc: Space
Well there are a couple things.
1. Yes you should run code normally to check if it's been run before or not. 2. Unless your users are local administrators on their systems (not a best practice) then they won't be able to create these entries in the HKLM part of the registry.
Here is code for what you asked, though if you really need to do this and your users don't have admin rights then you'll need to run code to accomplish this as an admin script remotely.