Instructions from Sony
I just had this issue, I assume you solved it but someone else might end up here looking like I did.
These were sent from John @ Sony support for the Z2 (Works for other models too though).
Running the software repair
Before you start you have to download the PC Companion software from http://www.sonymobile.com/gb/tools/pc-companion/
and install it on your PC.
Once installed on your PC, double-click the PC Companion icon on your desktop to start the update.
Please ensure your phone is powered off and not connected to the PC when you begin this process. You are not required to connect the phone until after step 10.
1. Install and open PC Companion then select Support Zone.
2. Phone Software Update.
4. Repair Phone
6. Accept data removal
8. Wait for prepare
9. Select Phone
10. Follow the connection steps
Just did this myself and I am back up and running (Pitty it happened in the first place though)