Skip to content

Commit fea4af5

Browse files
committed
Finalized V4.4 Update
1 parent 676ca86 commit fea4af5

File tree

4 files changed

+174
-187
lines changed

4 files changed

+174
-187
lines changed

Add-More-Features.ps1

Lines changed: 74 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -334,23 +334,16 @@ Create-File -fileContent $notification -fileName 'Enable - Notifications and Bac
334334
# Optimizations
335335
# Cleanup
336336
$cleanup = @'
337-
# Ensure the script runs as Administrator
338-
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
339-
Write-Output "Please run this script as Administrator."
340-
Pause
341-
Exit
342-
}
343-
344337
# Kill Process, Ignore Errors and Continue
345338
$ErrorActionPreference = 'SilentlyContinue'
346339
Get-Process -Name cleanmgr -EA 0 | Stop-Process -Force -EA 0
347340
348341
# Function to display sections
349342
function Show-Message ($message) {
350-
Write-Output "==========================================="
351-
Write-Output " $message"
352-
Write-Output "==========================================="
353-
Start-Sleep -Seconds 2
343+
Write-Output "==========================================="
344+
Write-Output " $message"
345+
Write-Output "==========================================="
346+
Start-Sleep -Seconds 1
354347
}
355348
356349
# Show initial disk space
@@ -359,96 +352,95 @@ $initialFreeGB = [math]::Round($initialFreeMB / 1024, 2)
359352
360353
Show-Message "Using Disk Cleanup with custom configuration"
361354
$volumeCache = @{
362-
"Active Setup Temp Folders" = 2
363-
"BranchCache" = 2
364-
"Content Indexer Cleaner" = 2
365-
"Delivery Optimization Files" = 2
366-
"Device Driver Packages" = 2
367-
"Diagnostic Data Viewer database files" = 2
368-
"Downloaded Program Files" = 2
369-
"Feedback Hub Archive log files" = 2
370-
"Internet Cache Files" = 2
371-
"Language Pack" = 2
372-
"Offline Pages Files" = 2
373-
"Old ChkDsk Files" = 2
374-
"Recycle Bin" = 2
375-
"RetailDemo Offline Content" = 2
376-
"Setup Log Files" = 2
377-
"System error memory dump files" = 2
378-
"System error minidump files" = 2
379-
"Temporary Files" = 2
380-
"Temporary Setup Files" = 2
381-
"Temporary Sync Files" = 2
382-
"Update Cleanup" = 2
383-
"Upgrade Discarded Files" = 2
384-
"User file versions" = 2
385-
"Windows Defender" = 2
386-
"Windows Error Reporting Files" = 2
387-
"Windows ESD installation files" = 2
388-
"Windows Reset Log Files" = 2
389-
"Windows Upgrade Log Files" = 2
355+
"Active Setup Temp Folders" = 2
356+
"BranchCache" = 2
357+
"Content Indexer Cleaner" = 2
358+
"Delivery Optimization Files" = 2
359+
"Device Driver Packages" = 2
360+
"Diagnostic Data Viewer database files" = 2
361+
"Downloaded Program Files" = 2
362+
"Feedback Hub Archive log files" = 2
363+
"Internet Cache Files" = 2
364+
"Language Pack" = 2
365+
"Offline Pages Files" = 2
366+
"Old ChkDsk Files" = 2
367+
"Recycle Bin" = 2
368+
"RetailDemo Offline Content" = 2
369+
"Setup Log Files" = 2
370+
"System error memory dump files" = 2
371+
"System error minidump files" = 2
372+
"Temporary Files" = 2
373+
"Temporary Setup Files" = 2
374+
"Temporary Sync Files" = 2
375+
"Update Cleanup" = 2
376+
"Upgrade Discarded Files" = 2
377+
"User file versions" = 2
378+
"Windows Defender" = 2
379+
"Windows Error Reporting Files" = 2
380+
"Windows ESD installation files" = 2
381+
"Windows Reset Log Files" = 2
382+
"Windows Upgrade Log Files" = 2
390383
}
391384
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"
392385
foreach ($item in $volumeCache.GetEnumerator()) {
393-
$keyPath = Join-Path $registryPath $item.Key
394-
if (Test-Path $keyPath) {
395-
New-ItemProperty -Path $keyPath -Name StateFlags1337 -Value $item.Value -PropertyType DWord | Out-Null
396-
}
386+
$keyPath = Join-Path $registryPath $item.Key
387+
if (Test-Path $keyPath) {
388+
New-ItemProperty -Path $keyPath -Name StateFlags1337 -Value $item.Value -PropertyType DWord | Out-Null
389+
}
397390
}
398391
Start-Process -FilePath "$env:SystemRoot\system32\cleanmgr.exe" -ArgumentList "/sagerun:1337" -Wait:$false
399392
400393
Show-Message "Cleaning up leftovers"
401394
$foldersToRemove = @(
402-
"CbsTemp",
403-
"Logs",
404-
"Panther",
405-
"Prefetch",
406-
"SoftwareDistribution",
407-
"System32\LogFiles",
408-
"System32\LogFiles\WMI",
409-
"System32\SleepStudy",
410-
"System32\sru",
411-
"System32\WDI\LogFiles",
412-
"System32\winevt\Logs",
413-
"SystemTemp",
414-
"Temp"
395+
"C:\CbsTemp",
396+
"C:\Logs",
397+
"C:\Panther",
398+
"C:\Prefetch",
399+
"C:\ProgramData\Microsoft\Windows Defender\Scans",
400+
"C:\Program Files (x86)\Microsoft\EdgeUpdate\Download",
401+
"C:\SoftwareDistribution",
402+
"C:\System32\LogFiles",
403+
"C:\System32\LogFiles\WMI",
404+
"C:\System32\SleepStudy",
405+
"C:\System32\sru",
406+
"C:\System32\WDI\LogFiles",
407+
"C:\System32\winevt\Logs",
408+
"C:\SystemTemp",
409+
"C:\Temp"
415410
)
416411
417-
foreach ($folderName in $foldersToRemove) {
418-
$folderPath = Join-Path $env:SystemRoot $folderName
419-
if (Test-Path $folderPath) {
420-
Remove-Item -Path "$folderPath\*" -Force -Recurse | Out-Null
412+
foreach ($folderPath in $foldersToRemove) {
413+
if (Test-Path $folderPath) {
414+
try {
415+
& takeown /F $folderPath /R /D Y *> $null
416+
& icacls $folderPath /grant Administrators:F /T *> $null
417+
Write-Output " - Deleted Files from Folder: $($folderPath)"
418+
Remove-Item -Path "$folderPath\*" -Force -Recurse
421419
}
420+
catch {}
421+
}
422+
}
423+
$fileTypes = @("C:\*.tmp", "C:\*.log", "C:\*.chk", "C:\*.old")
424+
foreach ($path in $fileTypes) {
425+
Get-ChildItem -Path $path -Recurse -Force | ForEach-Object {
426+
try {
427+
Remove-Item -Path $_.FullName -Force -Recurse
428+
Write-Output " - Deleted File: $($_.FullName)"
429+
} catch {}
430+
}
422431
}
423-
Remove-Item -Path "C:\Program Files\WindowsApps\MicrosoftWindows.Client.WebExperience*" -Recurse -Force
424-
425-
Show-Message "Cleaning up %TEMP% and Log Files"
426-
Get-ChildItem -Path "$env:TEMP" | Remove-Item -Recurse -Force
427-
Get-ChildItem -Path "$env:SystemRoot" -Filter *.log -File -Recurse -Force | Remove-Item -Recurse -Force | Out-Null
428-
429-
Show-Message "Cleaning up Event Logs"
430-
Get-EventLog -LogName * | ForEach-Object { Clear-EventLog $_.Log }
431432
432433
# Run DISM Component Cleanup
433434
Show-Message "Cleaning up WinSxS components"
434435
Dism /online /Cleanup-Image /StartComponentCleanup /ResetBase
435436
436-
# Clean Edge Update Downloads
437-
Show-Message "Cleaning up EdgeUpdate Downloads"
438-
$edgeUpdatePath = ${env:ProgramFiles(x86)} + "\Microsoft\EdgeUpdate\Download"
439-
if (Test-Path -Path $edgeUpdatePath) {
440-
Remove-Item -Path $edgeUpdatePath -Force -Recurse | Out-Null
441-
}
442-
443437
# Clean Empty Folders
444438
Show-Message "Cleaning Empty Folders"
445-
Get-ChildItem -Directory -Path "C:\" -Recurse -ErrorAction SilentlyContinue |
446-
Where-Object { try { ($_.GetFiles().Count -eq 0) -and ($_.GetDirectories().Count -eq 0) } catch { $false } } |
447-
ForEach-Object {
448-
try {
449-
Remove-Item $_.FullName -Force -Recurse -ErrorAction SilentlyContinue
450-
Write-Output "Deleted Empty Folder: $($_.FullName)"
451-
} catch {}
439+
Get-ChildItem -Directory -Path "C:\" -Recurse | Where-Object { try { ($_.GetFiles().Count -eq 0) -and ($_.GetDirectories().Count -eq 0) } catch { $false } } | ForEach-Object {
440+
try {
441+
Remove-Item $_.FullName -Force -Recurse
442+
Write-Output " - Deleted Empty Folder: $($_.FullName)"
443+
} catch {}
452444
}
453445
454446
# Clean System Restore Points
@@ -460,11 +452,9 @@ $finalFreeMB = (Get-PSDrive -Name C).Free / 1MB
460452
$finalFreeGB = [math]::Round($finalFreeMB / 1024, 2)
461453
$freedSpaceMB = $finalFreeMB - $initialFreeMB
462454
$freedSpaceGB = [math]::Round($freedSpaceMB / 1024, 2)
463-
464455
Show-Message "Before Cleanup: $initialFreeMB MB ($initialFreeGB GB) Free"
465456
Show-Message "After Cleanup: $finalFreeMB MB ($finalFreeGB GB) Free"
466457
Show-Message "Freed Space: $freedSpaceMB MB ($freedSpaceGB GB)"
467-
468458
Pause
469459
'@
470460
Create-File -fileContent $cleanup -fileName 'Cleanup.ps1' -fileDirectory $optimizationPath
@@ -496,19 +486,11 @@ pause & exit
496486
set reg1="HKCU\System\GameConfigStore"
497487
set reg2="HKLM\SOFTWARE\Policies\Microsoft\Windows\GameDVR"
498488
if "%~n0"=="Enable - GameDVR" (
499-
reg add %reg1% /v GameDVR_FSEBehavior /t REG_DWORD /d 0 /f
500489
reg add %reg1% /v GameDVR_Enabled /t REG_DWORD /d 1 /f
501-
reg add %reg1% /v GameDVR_DXGIHonorFSEWindowsCompatible /t REG_DWORD /d 0 /f
502-
reg add %reg1% /v GameDVR_HonorUserFSEBehaviorMode /t REG_DWORD /d 0 /f
503-
reg add %reg1% /v GameDVR_EFSEFeatureFlags /t REG_DWORD /d 1 /f
504490
reg add %reg2% /v AllowGameDVR /t REG_DWORD /d 1 /f
505491
ren "%~dpnx0" "Disable - GameDVR.cmd"
506492
) else (
507-
reg delete %reg1% /v GameDVR_FSEBehavior /f
508493
reg delete %reg1% /v GameDVR_Enabled /f
509-
reg delete %reg1% /v GameDVR_DXGIHonorFSEWindowsCompatible /f
510-
reg delete %reg1% /v GameDVR_HonorUserFSEBehaviorMode /f
511-
reg delete %reg1% /v GameDVR_EFSEFeatureFlags /f
512494
reg delete %reg2% /v AllowGameDVR /f
513495
ren "%~dpnx0" "Enable - GameDVR.cmd"
514496
)

CHANGELOGS.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
# Changelogs - V4.4
2+
## Answer File Changes
3+
- *Removed Pins and One Drive from the Start Menu (in Windows 10), also made some minor changes.
4+
- *Changed Locations of some files of the Shivaay folder.
5+
- Fixed Clipboard Delay (Thanks to Aftab for pointing out this issue)
6+
- *Not Restoring Legacy Photo Viewer by default.
7+
- *Using My Safemode approach to disable defender as it's a more efficient way.
8+
- *Disabled Core Isolation again by default as it reduces CPU performance by 5% (in my case).
9+
- *Removed additional commands for disabling various components, as the running folder scripts can handle it as well.
10+
- Removed BranchReadinessLevel policy registry looks like it doesn't do anything.
11+
- Removed Smart Screen script (I'll work on it later).
12+
13+
## Shivaay Folder Changes
14+
- Updated Cleanup Script (Fully Changed Cleaning methods and converted it into a Powershell script)
15+
- Updated Defender Script (To automatically reboot to normal mode after Toggling defender)
16+
- *Included Compact OS (as I use this on every Installation)
17+
18+
## Additional Features Script Changes
19+
- Added Script to Restore or Remove Legacy Photo Viewer in System Management.
20+
21+
## Update Script Changes
22+
- Included everything from above, except the ones with an asterisk (*)
23+
124
# Changelogs - V4.3
225
## Answer File Changes
326
- Removed One registry for modifying OEM Info.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 🔮 Optimize Windows
2-
[![Version](https://img.shields.io/badge/Version-V4.3%20-2D9F2D?style=for-the-badge&logo=github&logoColor=white)](https://github.com/ShivamXD6/Optimize-Windows/releases/latest)
2+
[![Version](https://img.shields.io/badge/Version-V4.4%20-2D9F2D?style=for-the-badge&logo=github&logoColor=white)](https://github.com/ShivamXD6/Optimize-Windows/releases/latest)
33
[![User Base](https://img.shields.io/github/downloads/ShivamXD6/Optimize-Windows/total?style=for-the-badge&logo=github&label=User%20Base&link=https%3A%2F%2Fgithub.com%2FShivamXD6%2FOptimize-Windows%2Freleases%2Flatest)](https://github.com/ShivamXD6/Optimize-Windows/releases/latest)
44
[![License](https://img.shields.io/badge/License-GPL%20v3-0078D4?style=for-the-badge&logo=open-source-initiative&logoColor=white)](https://github.com/ShivamXD6/Optimize-Windows/blob/main/LICENSE)
55
![Last Updated](https://img.shields.io/github/last-commit/ShivamXD6/Optimize-Windows?style=for-the-badge&color=6A5ACD&label=Last%20Updated)
@@ -111,7 +111,6 @@
111111
- 🔍 Toggle Search Indexing
112112
- 🎥 Toggle GameDVR
113113
- 🔒 *Toggle Biometrics (Fingerprint and Face Unlock)
114-
- 💿 *Toggle Compact OS (Free up space by compressing Windows Binaries)
115114
- 📝 *Configure Shivaay OS (Like change OS name, Folder Location etc)
116115

117116
#### **Optimizations**
@@ -120,6 +119,7 @@
120119
- 🧹 Cleanup Script to clean unnecessary files and free up space
121120
- 💽 *Toggle Superfetch/Prefetch
122121
-*Toggle Delivery Optimization
122+
- 💿 Toggle Compact OS (Free up space by compressing Windows Binaries)
123123

124124
#### 🖥️ **User Interface**
125125
- 🖼️ Toggle Gallery and Home

0 commit comments

Comments
 (0)