Microsoft beat expectations in its fiscal second quarter but took a $13.8 billion accounting charge.