Please refer the script to Run Defrag on System Disk& use below procedure to defragment all partitions,
Major steps by procedures:
1. Download Defraggler defragmentation tool
2. Install the tool
3. Trigger defragmentation of using Defraggler command line utility (df.exe)
4. Uninstall the tool
1. Run the script as "system user"
2. No input requires