[TOOL] Backup TA v9.9 for Windows 
Backup TA for Sony Xperia
Backup TA can backup and restore the TA partition of the device. When you create a backup before unlocking for the first time, then you will be able to restore to full factory state (including a locked bootloader). This means all DRM keys intact, Bravia Engine working in Album and last but not least your warranty when needed
At the bottom of this post is the FAQ. Here you will find answers on the most asked questions. Read them before posting any question in this thread. When you want my support, tell me which device and version of Backup TA you're using and attach the complete output. I can not help you without this and besides it's really not so much to ask in return, now is it? No effort without effort.
This tool only works under Windows. Mac and Linux will not be supported. Using this tool is at your own risk.
Source (released under MIT license)
Stable releases do have a version tag like this: v1.0 (example)
Beta releases do have a version tag like this: v1.0b2 (example).
Sony Xperia Z1
Sony Xperia Z Ultra
Sony Xperia M
Sony Xperia ZR
Sony Xperia L
Sony Xperia SP
Sony Xperia Tablet Z
Sony Xperia Z
Sony Xperia ZL
Sony Xperia ZQ
All Compatible Devices
1. Download the latest version of Backup TA.
2. Extract the ZIP file to a folder location of your choosing.
3. Navigate to the folder location of Backup TA.
4. Make sure no other script or application which is using ADB is running.
5. Make sure the device is booted in normal mode (the way you normally use it).
6. Run Backup-TA.bat
7. Read the last paragraph of the license before continuing.
8. Read the information and follow the instructions given by the tool.
Backup Video Tutorial.
Kindly provided by @shem2409
Q: Is my device supported?
Look at the supported devices list above this FAQ. When it is not listed, try to make a backup it will tell you if your device is supported.
Q: Do I need root for this?
Yes, you do need root for this to work. I would advice to use @DooMLoRD
's excellent Easy Rooting Toolkit
for this, when not already rooted.
Q: Can I use someone else's backup?
No, this will hard-brick your device.
Q: Can I restore my TA.img file from Backup TA v4 and earlier?
Yes, choose "Convert v4 backup" in the menu.
Q: Does it bring back my DRM keys when I already unlocked my device?
Not without a backup of the TA before it was ever unlocked.
Q: Can I restore my TA while running a non-stock ROM or kernel?
Yes, but it will soft-brick your device and you need Sony PC Companion or Flashtool to fix it by flashing stock firmware. Best is to first return to a complete stock ROM and kernel before restoring the TA.
Q: Will a restore relock the bootloader?
Yes, it will relock the bootloader like it was never unlocked.
Q: What is 'restore dry-run'?
When you do a dry-run restore it will performs a regular restore with the exception that it will not write anything to your device. This is helpful to test a backup before restoring and very advisable.
Q: What is the correct file size for a backup?
The TA partition size can differ per model, so there is no one answer to this question. Also the TA partition contains a logging area which changes and thus can be different in size each time the device boots, which can lead to different compression size of the backup file. You can rest assured that your backup is fine, also in file size, when the tool says the backup was successful.