I have used this command to change Windows Server 2012 from Essentials to Standard.
dism /online /set-edition:ServerStandard /accepteula /productkey:<ProductKey>
Here is more information about the command and limitations.
https://technet.microsoft.com/en-us/library/hh825157.aspx