Skip to content

Commit

Permalink
misc: small fixes and refactors
Browse files Browse the repository at this point in the history
- Add end line to each archive
- Improved outputted stuff to console while running scripts
  • Loading branch information
LeDragoX committed May 19, 2022
1 parent f8ae489 commit ef53873
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/lib/set-service-startup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ function Set-ServiceStartup() {
[ScriptBlock] $CustomMessage
)

$Script:EnabledSecurityFilter = @("RemoteAccess", "RemoteRegistry")
$Script:SecurityFilterOnEnable = @("RemoteAccess", "RemoteRegistry")
$Script:TweakType = "Service"

ForEach ($Service in $Services) {
If (Find-Service $Service) {
If (($Service -in $EnabledSecurityFilter) -and (($Automatic) -or ($Manual))) {
If (($Service -in $SecurityFilterOnEnable) -and (($Automatic) -or ($Manual))) {
Write-Status -Symbol "?" -Type $TweakType -Status "Skipping $Service ($((Get-Service $Service).DisplayName)) to avoid a security vulnerability ..." -Warning
Continue
}
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/optimize-performance.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Optimize-Performance() {
$TweakType = "Performance"

If (($Revert)) {
Write-Status -Symbol "<" -Type $TweakType -Status "Reverting: $Revert." -Warning
Write-Status -Symbol "<" -Type $TweakType -Status "Reverting the tweaks is set to '$Revert'." -Warning
$Zero = 1
$One = 0
$EnableStatus = @(
Expand Down Expand Up @@ -146,12 +146,12 @@ function Optimize-Performance() {
}

function Main() {
If (!($Revert)) {
If (!$Revert) {
Optimize-Performance # Change from stock configurations that slowdowns the system to improve performance
}
Else {
Optimize-Performance -Revert
}
}

Main
Main
8 changes: 4 additions & 4 deletions src/scripts/optimize-privacy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function Optimize-Privacy() {
)
$TweakType = "Privacy"

If (($Revert)) {
Write-Host "[<][Privacy] Reverting: $Revert." -ForegroundColor Yellow -BackgroundColor Black
If ($Revert) {
Write-Status -Symbol "<" -Type $TweakType -Status "Reverting the tweaks is set to '$Revert'." -Warning
$Zero = 1
$One = 0
$EnableStatus = @(
Expand Down Expand Up @@ -345,12 +345,12 @@ function Optimize-Privacy() {
}

function Main() {
If (!($Revert)) {
If (!$Revert) {
Optimize-Privacy # Disable Registries that causes slowdowns and privacy invasion
}
Else {
Optimize-Privacy -Revert
}
}

Main
Main
2 changes: 1 addition & 1 deletion src/scripts/optimize-security.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ function Main() {
Optimize-Security # Improve the Windows Security
}

Main
Main
7 changes: 5 additions & 2 deletions src/scripts/optimize-services.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,21 @@ function Optimize-ServicesRunning() {
)

Write-Title -Text "Services tweaks"
Write-Section -Text "Disabling services from Windows"

If ($Revert) {
Write-Status -Symbol "<" -Type "Service" -Status "Reverting: $Revert" -Warning
Write-Status -Symbol "<" -Type "Service" -Status "Reverting the tweaks is set to '$Revert'." -Warning
$CustomMessage = { "Resetting $Service ($((Get-Service $Service).DisplayName)) as 'Manual' on Startup ..." }
Set-ServiceStartup -Manual -Services $ServicesToDisabled -Filter $EnableServicesOnSSD -CustomMessage $CustomMessage
}
Else {
Set-ServiceStartup -Disabled -Services $ServicesToDisabled -Filter $EnableServicesOnSSD
}

Write-Section -Text "Enabling services from Windows"

If ($IsSystemDriveSSD -or $Revert) {
$CustomMessage = { "The $Service ($((Get-Service $Service).DisplayName)) works better in 'Automatic' mode on SSDs ..." }
$CustomMessage = { "The $Service ($((Get-Service $Service).DisplayName)) service works better in 'Automatic' mode on SSDs ..." }
Set-ServiceStartup -Automatic -Services $EnableServicesOnSSD -CustomMessage $CustomMessage
}

Expand Down
8 changes: 4 additions & 4 deletions src/scripts/optimize-task-scheduler.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ function Optimize-TaskScheduler() {
)

Write-Title -Text "Task Scheduler tweaks"
Write-Section -Text "Disabling Scheduled Tasks"
Write-Section -Text "Disabling Scheduled Tasks from Windows"

If ($Revert) {
Write-Status -Symbol "<" -Type "TaskScheduler" -Status "Reverting: $Revert." -Warning
Write-Status -Symbol "<" -Type "TaskScheduler" -Status "Reverting the tweaks is set to '$Revert'." -Warning
$CustomMessage = { "Resetting the $ScheduledTask task as 'Ready' ..." }
Set-ScheduledTaskState -Ready -ScheduledTask $DisableScheduledTasks -CustomMessage $CustomMessage
}
Else {
Set-ScheduledTaskState -Disabled -ScheduledTask $DisableScheduledTasks
}

Write-Section -Text "Enabling Scheduled Tasks"
Write-Section -Text "Enabling Scheduled Tasks from Windows"
Set-ScheduledTaskState -Ready -ScheduledTask $EnableScheduledTasks
}

Expand All @@ -75,4 +75,4 @@ function Main() {
}
}

Main
Main
6 changes: 3 additions & 3 deletions src/scripts/personal-tweaks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Register-PersonalTweaksList() {
$TweakType = "Personal"

If ($Revert) {
Write-Status -Symbol "<" -Type $TweakType -Status "Reverting: $Revert."
Write-Status -Symbol "<" -Type $TweakType -Status "Reverting the tweaks is set to '$Revert'." -Warning
$Zero = 1
$One = 0
$EnableStatus = @(
Expand Down Expand Up @@ -245,12 +245,12 @@ function Register-PersonalTweaksList() {
}

function Main() {
If (!($Revert)) {
If (!$Revert) {
Register-PersonalTweaksList # Personal UI, Network, Energy and Accessibility Optimizations
}
Else {
Register-PersonalTweaksList -Revert
}
}

Main
Main
6 changes: 3 additions & 3 deletions src/scripts/reinstall-pre-installed-apps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function Main() {
exit
}
Else {
Write-Host "Registering the provisioned apps that match $PackageFilter..."
Write-Host "Registering the provisioned apps that match $PackageFilter ..."
}
}

Expand All @@ -25,9 +25,9 @@ function Main() {
$PackageName = $Package | Get-ItemProperty | Select-Object -ExpandProperty PSChildName
$PackagePath = [System.Environment]::ExpandEnvironmentVariables(($Package | Get-ItemProperty | Select-Object -ExpandProperty Path))
# Register the package
Write-Host "Attempting to register package: $PackageName."
Write-Host "Attempting to register package: $PackageName ..."
Add-AppxPackage -register $PackagePath -DisableDevelopmentMode
}
}

Main
Main
3 changes: 2 additions & 1 deletion src/scripts/remove-bloatware-apps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ function Remove-BloatwareAppsList() {
)

Write-Title -Text "Remove Bloatware Apps"
Write-Section -Text "Removing Windows unneeded Apps"
Remove-UWPAppx -AppxPackages $Apps
}

Expand All @@ -173,4 +174,4 @@ function Main() {
Remove-BloatwareAppsList # Remove the main Bloat from Pre-installed Apps
}

Main
Main
2 changes: 1 addition & 1 deletion src/scripts/remove-onedrive.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ function Main() {
Remove-OneDrive
}

Main
Main
2 changes: 1 addition & 1 deletion src/scripts/repair-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ function Main() {
Repair-System
}

Main
Main
2 changes: 1 addition & 1 deletion src/scripts/silent-debloat-softwares.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ function Main() {
Use-DebloatSoftware # [AUTOMATED] ShutUp10 with recommended configs and AdwCleaner for Adware/Virus Scanning.
}

Main
Main

0 comments on commit ef53873

Please sign in to comment.