Knowledge - Details
Date Added: 5/4/2017
While trying to run Optimize-Volume from powershell, you may get an error. If you use -Verbose, you'll see that it successfully analyzes the volume and shows the details, but as soon as it hits 0% on teh draf process, it fails.
Event Log errors:
The volume (Z:) was not optimized because an error was encountered: The parameter is incorrect. (0x80070057)
The volume (Z:) was not optimized because an error was encountered: Element not found. (0x80070490)
To fix this, run these two commands from the command prompt (replace Z: with the drive letter you're trying to fix):
fsutil usn deletejournal /D Z:
fsutil usn createjournal m=1000 a=100 Z:
I had this problem on a VHDX file, which seemed to work fine otherwise. After running the two above commands, I could immediately do the Optimize-Volume command without error.
Disclaimer: Everything on this website is written for my own use. I disclaim any guarantees that the procedures and advice listed here are accurate, safe, or beneficial for anyone else. If you attempt to follow any procedures or advice shared here, you do it at your own risk. Part of IT work is knowing how to recover from problems.