-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
G'day,
Love your work.
Not sure how to contribute new to GitHub - yes I'll google it late haha
I have expanded on your nice work.
it uses sdelete to zero the blocks
then defrags
then compacts.
In my case runaway print cache folder I found your script useful on a 6GB UPD as an example
I removed a 4GB folder compact alone was 100MB saved
sdelete gave me about 400MB
sdelete plus defrag gave me about 4GB back ....
Below is what I ended up with.
$VHDXPaths = @(
'D:\CMVTBDealerPRO'
)
$VHDXExclusions = @(
'UVHD-template.vhdx'
)
Foreach ($Path in $VHDXPaths){
$AllUPDs = Get-ChildItem $Path -Recurse -Filter *.vhdx | Where-Object {$VHDXExclusions -NotContains $_.name} | Select-Object -ExpandProperty fullname
foreach ($UPD in $AllUPDs){
New-Item -Name compact.txt -ItemType file -force | OUT-NULL
ADD-CONTENT -Path compact.txt "select vdisk file= $UPD"
ADD-CONTENT -Path compact.txt "attach vdisk"
DISKPART /S compact.TXT
.\sdelete64.exe -z E:\
Start-Sleep -s 3
defrag E:
New-Item -Name compact.txt -ItemType file -force | OUT-NULL
ADD-CONTENT -Path compact.txt "select vdisk file= $UPD"
ADD-CONTENT -Path compact.txt "detach vdisk"
DISKPART /S compact.TXT
NEW-ITEM -Name compact.txt -ItemType file -force | OUT-NULL
ADD-CONTENT -Path compact.txt "select vdisk file= $UPD"
ADD-CONTENT -Path compact.txt "compact vdisk"
DISKPART /S compact.TXT
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels