CmdID / PowerShell / Cmdlets / Optimize
Optimize-VHD
Optimizes the allocation of space used by virtual hard disk files, except for fixed virtual hard disks. Windows Server PowerShell reference
From the Windows Server PowerShell reference 9 parameters Its page in the reference
Parameters
-AsJobRuns the cmdlet as a background job.-CimSessionRuns the cmdlet in a remote session or on a remote computer.-ComputerNameSpecifies one or more Hyper-V hosts on which a virtual machine is to be optimized.-Confirm, -cfPrompts you for confirmation before running the cmdlet.-CredentialSpecifies one or more user accounts that have permission to perform this action.-ModeSpecifies the mode in which the virtual hard disk is to be optimized.-PassthruSpecifies that an object is to be passed through to the pipeline representing the virtual hard disk to be optimized.-Path, -FullNameSpecifies one or more paths to the dynamic or differencing virtual hard disk files to be optimized.-WhatIf, -wiShows what would happen if the cmdlet runs.