mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-13 18:07:20 -06:00
f162de89be
- Updated BuildFFUUnattend files to point to the new Orchestrator.ps1 file. - Added new common and FFUUI.Core directories that house common/shared files between the UI and PS1 script. This breaks up each of the PS1 scripts to keep things smaller and more organized. Still a lot of work to do here to pull some stuff out of the PS1 scripts. - Modified the CaptureFFU.ps1 file to include more info during the capture process to help with troubleshooting - Too many functional changes to list here.
21 lines
906 B
PowerShell
21 lines
906 B
PowerShell
# Run disk cleanup (cleanmgr.exe) with all options enabled
|
|
# Reference: https://learn.microsoft.com/en-us/troubleshoot/windows-server/backup-and-storage/automating-disk-cleanup-tool
|
|
|
|
$rootKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"
|
|
|
|
# Set StateFlags0000 to 2 for all subkeys except "Offline Pages Files"
|
|
Get-ChildItem -Path $rootKey | ForEach-Object {
|
|
if ($_.PSChildName -ne "Offline Pages Files") {
|
|
Set-ItemProperty -Path $_.PSPath -Name "StateFlags0000" -Type DWord -Value 2 -Force
|
|
}
|
|
}
|
|
|
|
# Run the disk cleanup tool with the specified flags
|
|
Start-Process -FilePath "cleanmgr.exe" -ArgumentList "/sagerun:0" -Wait
|
|
|
|
# Remove the StateFlags0000 registry values that were added
|
|
Get-ChildItem -Path $rootKey | ForEach-Object {
|
|
if ($_.PSChildName -ne "Offline Pages Files") {
|
|
Remove-ItemProperty -Path $_.PSPath -Name "StateFlags0000" -Force
|
|
}
|
|
} |