Unable to optimize SSD drive - Showing CimException for Optimize-Volume

Roel Vlemmings 0 Reputation points
2024-01-01T05:28:47.5166667+00:00

When I run drive optimization from the Tools menu of Windows Explorer, it completes almost instantly, but then it still shows Needs Optimization. If I run it from PowerShell in Verbose mode, it shows a CimException as displayed below. Please advise.

Optimize-Volume -DriveLetter F: -ReTrim -Verbose                                                
Optimize-Volume : No MSFT_Volume objects found with property 'DriveLetter' equal to ':'.  
Verify the value of the property and retry.                                                                                                     
At line:1 char:1
+ Optimize-Volume -DriveLetter F: -ReTrim -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (::Char) [Optimize-Volume], CimJobException
    + FullyQualifiedErrorId : CmdletizationQuery_NotFound_DriveLetter,Optimize-Volume

VERBOSE: Invoking retrim on T7 (F:)...
VERBOSE: Retrim:  0% complete...
VERBOSE: Retrim:  100% complete.
Optimize-Volume : Failed
Activity ID: {d7be6109-3c6e-0006-0f65-bed76e3cda01}
At line:1 char:1
+ Optimize-Volume -DriveLetter F: -ReTrim -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (StorageWMI:ROOT/Microsoft/...age/MSFT_Volume) [Optimize-Volume], CimException
    + FullyQualifiedErrorId : StorageWMI 4,Optimize-Volume
Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2024-01-01T15:45:16.2033333+00:00

    The parameter DriveLetter must be an array of CHARACTERS. You don't have a drive letter ":".

    To fix your problem, remove the ":".

    Syntax

    Optimize-Volume [-DriveLetter] <Char[]>

    0 comments No comments

  2. Anonymous
    2024-01-03T06:12:21.37+00:00

    Hi Roel Vlemmings,

    It seems the Optimize-Volume cmdlet has finished resending the TRIM requests. Please manually restart the optimize drives service (defragsvc) and see if the issue persists.

    Also run defrag.exe c: /retrim to see if the operation can be completed normally.

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.