"What were you thinking..."
I think the following are all reasonably neutral:
What led you to... ?
What motivated you to... ?
How were you feeling when you... ?
What prompted you to ... ?
Why did you... ?
If you want to convey approval, try:
What inspired you to... ?
(Inspiration is generally seen as a good thing.)
If you want to convey disapproval:
What possessed you to... ?
(When people talk about people being possessed there is often a connotation of "for an evil purpose"; the most prominent possessing being is the devil.)
Of course, words alone are often not sufficient to convey your feelings; context and tone of voice matter too. "What were you thinking?" can be highly negative, as already pointed out, or neutral.
Perhaps, but tread lightly. "What were you thinking ..." is often a softer way of saying "well, that was pretty stupid". If you watch your intonation, you'll get the real question across, but if you're at all excited when speaking (or if it's presented in writing), then the listener (or reader) is likely to assume you're questioning their sanity or intelligence.