NAME
Optimize-Volume
SYNOPSIS
Optimizes a volume.SYNTAX
Optimize-Volume [-DriveLetter]
[-Analyze] [-CimSession ] [-Defrag] [-NormalPriority] [-ReTrim] [-SlabConsolidate] [-ThrottleLimit
] [-TierOptimize] [-Confirm] [-WhatIf] [ ] Optimize-Volume [-Analyze] [-CimSession
] [-Defrag] [-NormalPriority] [-ReTrim] [-SlabConsolidate] [-ThrottleLimit
] [-TierOptimize] -Path [-Confirm] [-WhatIf] [ ] Optimize-Volume [-Analyze] [-CimSession
] [-Defrag] [-NormalPriority] [-ReTrim] [-SlabConsolidate] [-ThrottleLimit
] [-TierOptimize] -ObjectId [-Confirm] [-WhatIf] [ ] Optimize-Volume [-Analyze] [-CimSession
] [-Defrag] [-NormalPriority] [-ReTrim] [-SlabConsolidate] [-ThrottleLimit
] [-TierOptimize] [-Confirm] [-WhatIf] [ ] Optimize-Volume [-Analyze] [-CimSession
] [-Defrag] [-NormalPriority] [-ReTrim] [-SlabConsolidate] [-ThrottleLimit
] [-TierOptimize] -FileSystemLabel [-Confirm] [-WhatIf] [ ] DESCRIPTION
The Optimize-Volume cmdlet optimizes a volume, performing defragmentation, trim, slab consolidation, and storage
tier processing. If no parameter is specified, then the default operation will be performed per the drive type as follows.-- HDD, Fixed VHD, Storage Space. -Analyze -Defrag.
-- Tiered Storage Space. -TierOptimize.
-- SSD with TRIM support. -Retrim.
-- Storage Space (Thinly provisioned), SAN Virtual Disk (Thinly provisioned), Dynamic VHD, Differencing VHD.
-Analyze -SlabConsolidate -Retrim.
-- SSD without TRIM support, Removable FAT, Unknown. No operation.
PARAMETERS
-Analyze [
Analyzes the volume specified for fragmentation statistics. Performs analysis only and reports the current optimization state of the volume. Required? false Position? named Default value none Accept pipeline input? false Accept wildcard characters? false] -CimSession [
Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such] as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local
computer. Required? false Position? named Default value none Accept pipeline input? false Accept wildcard characters? false-Defrag [
Indicates that the cmdlet initiates defragmentation on the specified volume. Defragmentation consolidates fragmented regions of files to improve performance of sequential reads or writes. Required? false Position? named Default value none Accept pipeline input? false Accept wildcard characters? false] -DriveLetter
Specifies the drive letter of the volume to optimize. Required? true Position? 1 Default value noneAccept pipeline input? True (ByPropertyName)
Accept wildcard characters? false-FileSystemLabel
Specifies the file system label of the volume to optimize. Required? true Position? named Default value noneAccept pipeline input? True (ByPropertyName)
Accept wildcard characters? false-NormalPriority [
Indicates that this cmdlet the operation at normal priority. By default, the priority is low. Required? false Position? named Default value none Accept pipeline input? false Accept wildcard characters? false] -ObjectId
Specifies the ID of the volume to optimize. Required? true Position? named Default value noneAccept pipeline input? True (ByPropertyName)
Accept wildcard characters? false-Path
Specifies the path of the volume to optimize. Required? true Position? named Default value noneAccept pipeline input? True (ByPropertyName)
Accept wildcard characters? false-ReTrim [
Generates TRIM and Unmap hints for all currently unused sectors of the volume, notifying the underlying storage that the sectors are no longer needed and can be purged. This can recover unused capacity on thinly provisioned drives. Required? false Position? named Default value none Accept pipeline input? false Accept wildcard characters? false] -SlabConsolidate [
Indicates that the cmdlet performs slab consolidation on the storage to optimize slab allocations and to reduce the number of used slabs. Required? false Position? named Default value none Accept pipeline input? false Accept wildcard characters? false] -ThrottleLimit [
Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShellr calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. Required? false Position? named Default value none Accept pipeline input? false Accept wildcard characters? false] -TierOptimize [
Indicates that the cmdlet performs tier optimization of the volume, which places file data on the optimal storage tier according to heat or desired placement. This parameter only applies to tiered spaces volumes with more than one storage tier. Required? false Position? named Default value none Accept pipeline input? false Accept wildcard characters? false] -Confirm [
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet. Required? false Position? named Default value false Accept pipeline input? false Accept wildcard characters? false] -WhatIf [
Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run. Required? false Position? named Default value false Accept pipeline input? false Accept wildcard characters? false] This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). INPUTS
Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Volume http://msdn.microsoft.com/library/windows/desktop/hh830604.aspx You can use the pipeline operator to pass a Volume object to the InputObject parameter.OUTPUTS
This cmdlet does not generate output.Example 1: Perform TRIM optimization
PS C:\>Optimize-Volume -DriveLetter H -ReTrim -Verbose
This example optimizes drive H by re-sending Trim requests. This is useful on SSD media, and thinly provisioned
storage.Example 2: Analyze a volume
PS C:\>Optimize-Volume -DriveLetter H -Analyze -Verbose
This example reports only the current optimization state of drive H.Example 3: Defragment a volume
PS C:\>Optimize-Volume -DriveLetter H -Defrag -Verbose
This example defragments drive H.Example 4: Perform slab consolidation
PS C:\>Optimize-Volume -DriveLetter H -SlabConsolidate -Verbose
This example performs slab consolidation on the storage space backing volume H.Example 5: Tier optimize a volume
PS C:\>Optimize-Volume -DriveLetter H -TierOptimize
This example performs tier optimization on the tiered storage space backing volume H.RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/?LinkId=816446Format-Volume
Get-Volume
Repair-Volume
Set-Volume