Also, server is not their cash cow. Between desktop Windows, consumer hardware (including the Surface, mice, keyboards, etc) and business software they pull in about $44B. Their server products, including Azure, MS SQL, consulting services, and development tools only bring in about $20B. Entertainment and mobile bring in another $10B.
Microsoft benefits from having a broad, comprehensive product line, whether the divisions themselves are necessarily profitable. Just like Apple, Google, and Amazon, they benefit from getting people to buy into their ecosystem.
They have struggled in recent years, not just because Apple's resurgence has eroded their dominance in the PC market, but because the market has shifted away from the PC model. More people are using tablets or even phones as their primary device, which means more people using iOS, Android or Amazon devices, and their associated app, content and services ecosystems.
Their response seems to be increased openness (see: open sourced