Clean up / Linting

This commit is contained in:
Raphire
2025-05-04 23:33:20 +02:00
parent d294eb6b7a
commit 94d67c3f54

View File

@@ -737,9 +737,8 @@ function GetUserName {
if ($global:Params.ContainsKey("User")) { if ($global:Params.ContainsKey("User")) {
return $global:Params.Item("User") return $global:Params.Item("User")
} }
else {
return $env:USERNAME return $env:USERNAME
}
} }
@@ -756,7 +755,6 @@ function CreateSystemRestorePoint {
} }
if ($recentRestorePoints.Count -eq 0) { if ($recentRestorePoints.Count -eq 0) {
try { try {
Checkpoint-Computer -Description "Restore point created by Win11Debloat" -RestorePointType "MODIFY_SETTINGS" Checkpoint-Computer -Description "Restore point created by Win11Debloat" -RestorePointType "MODIFY_SETTINGS"
Write-Output "System restore point created successfully" Write-Output "System restore point created successfully"
@@ -1408,17 +1406,17 @@ else {
PrintHeader 'Custom Mode' PrintHeader 'Custom Mode'
} }
# If the number of keys in SPParams equals the number of keys in Params then no modifications/changes were selected # If the number of keys in SPParams equals the number of keys in Params then no modifications/changes were selected
# or added by the user, and the script can exit without making any changes. # or added by the user, and the script can exit without making any changes.
if ($SPParamCount -eq $global:Params.Keys.Count) { if ($SPParamCount -eq $global:Params.Keys.Count) {
Write-Output "The script completed without making any changes." Write-Output "The script completed without making any changes."
AwaitKeyToExit AwaitKeyToExit
Exit
} }
else {
# Execute all selected/provided parameters # Execute all selected/provided parameters
switch ($global:Params.Keys) { switch ($global:Params.Keys) {
'CreateRestorePoint' { 'CreateRestorePoint' {
CreateSystemRestorePoint CreateSystemRestorePoint
continue continue
@@ -1642,14 +1640,13 @@ else {
RegImport "> Hiding 'Share' in the context menu..." "Disable_Share_from_context_menu.reg" RegImport "> Hiding 'Share' in the context menu..." "Disable_Share_from_context_menu.reg"
continue continue
} }
}
RestartExplorer
Write-Output ""
Write-Output ""
Write-Output ""
Write-Output "Script completed! Please check above for any errors."
AwaitKeyToExit
} }
RestartExplorer
Write-Output ""
Write-Output ""
Write-Output ""
Write-Output "Script completed! Please check above for any errors."
AwaitKeyToExit