When you say policies a normal user cannot set POLICIES a GPO is typically the accepted means to do so. As far as writing HKCU keys those may not be loaded yet to write to. You can write some debug code to show on screen the error and test on your own before trying to push out to users.

I must ask though why use Samba? A Windows Server 2012 license is only like $800 and will make life so much easier than fighting the square block going into the round hole of
Linux/Windows games.