See the question and my original answer on StackOverflow

It's located in the famous (yet undocumented :-) "UserPreferencesMask" registry key. Here are some pointers:

A first general link with information on this key, and how the mouse shadow setting is defined: HKCU\Control Panel\Desktop\UserPreferencesMask

And a sample that explain how to code it using VBSCript (it's another key, but the principle is the same): Set UserPreferencesMask Binary Registry Key