Only certain NPCs can become your spouse, and I'm not sure if console commands can force this. Marriage in Skyrim is very overrated.
Console Commands are a debugging tool available to PC players, adding a wide range of functionality to the game. On American English keyboards, the tilde key (~) will toggle the console screen, but on British English keyboards, that key is the grave key ( ` ).
However, if I make sure that nothing is selected, then if works. What I mean, is, in the console, when you have something selected, you can see the refID. If you can see any refID, then setessential will not work.