Skip to content

Commit

Permalink
Improved errors readability and NetworkAdaptersSavePower function
Browse files Browse the repository at this point in the history
  • Loading branch information
farag2 committed Oct 27, 2024
1 parent 6a75ec8 commit 0b7300c
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);

# Remove firewalled IP addresses that block Microsoft recourses added by harmful tweakers
# https://wpd.app
Get-NetFirewallRule | Where-Object -FilterScript {($_.DisplayName -match "Blocker MicrosoftTelemetry") -or ($_.DisplayName -match "Blocker MicrosoftExtra") -or ($_.DisplayName -match "windowsSpyBlocker")} | Remove-NetFirewallRule
Get-NetFirewallRule -DisplayName "Blocker MicrosoftTelemetry*", "Blocker MicrosoftExtra*", "windowsSpyBlocker*" -ErrorAction Ignore | Remove-NetFirewallRule

Write-Information -MessageData "" -InformationAction Continue
# Extract the localized "Please wait..." string from shell32.dll
Expand Down
2 changes: 1 addition & 1 deletion src/Sophia_Script_for_Windows_10/Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ $ScriptFiles = @(
if (($ScriptFiles | Test-Path) -contains $false)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message "There are no files in the bin folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Warning -Message "There are no files in the script folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Information -MessageData "" -InformationAction Continue

Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);

# Remove firewalled IP addresses that block Microsoft recourses added by harmful tweakers
# https://wpd.app
Get-NetFirewallRule | Where-Object -FilterScript {($_.DisplayName -match "Blocker MicrosoftTelemetry") -or ($_.DisplayName -match "Blocker MicrosoftExtra") -or ($_.DisplayName -match "windowsSpyBlocker")} | Remove-NetFirewallRule
Get-NetFirewallRule -DisplayName "Blocker MicrosoftTelemetry*", "Blocker MicrosoftExtra*", "windowsSpyBlocker*" -ErrorAction Ignore | Remove-NetFirewallRule

Write-Information -MessageData "" -InformationAction Continue
# Extract the localized "Please wait..." string from shell32.dll
Expand Down
2 changes: 1 addition & 1 deletion src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ $ScriptFiles = @(
if (($ScriptFiles | Test-Path) -contains $false)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message "There are no files in the bin folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Warning -Message "There are no files in the script folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Information -MessageData "" -InformationAction Continue

Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);

# Remove firewalled IP addresses that block Microsoft recourses added by harmful tweakers
# https://wpd.app
Get-NetFirewallRule | Where-Object -FilterScript {($_.DisplayName -match "Blocker MicrosoftTelemetry") -or ($_.DisplayName -match "Blocker MicrosoftExtra") -or ($_.DisplayName -match "windowsSpyBlocker")} | Remove-NetFirewallRule
Get-NetFirewallRule -DisplayName "Blocker MicrosoftTelemetry*", "Blocker MicrosoftExtra*", "windowsSpyBlocker*" -ErrorAction Ignore | Remove-NetFirewallRule

Write-Information -MessageData "" -InformationAction Continue
# Extract the localized "Please wait..." string from shell32.dll
Expand Down
2 changes: 1 addition & 1 deletion src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ $ScriptFiles = @(
if (($ScriptFiles | Test-Path) -contains $false)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message "There are no files in the bin folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Warning -Message "There are no files in the script folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Information -MessageData "" -InformationAction Continue

Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);

# Remove firewalled IP addresses that block Microsoft recourses added by harmful tweakers
# https://wpd.app
Get-NetFirewallRule | Where-Object -FilterScript {($_.DisplayName -match "Blocker MicrosoftTelemetry") -or ($_.DisplayName -match "Blocker MicrosoftExtra") -or ($_.DisplayName -match "windowsSpyBlocker")} | Remove-NetFirewallRule
Get-NetFirewallRule -DisplayName "Blocker MicrosoftTelemetry*", "Blocker MicrosoftExtra*", "windowsSpyBlocker*" -ErrorAction Ignore | Remove-NetFirewallRule

Write-Information -MessageData "" -InformationAction Continue
# Extract the localized "Please wait..." string from shell32.dll
Expand Down Expand Up @@ -690,7 +690,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Write-Error -Message ($Localization.NoResponse -f "https://github.com") -ErrorAction SilentlyContinue
}

# Check whether all necessary files exist in the bin folder
# Check whether all necessary files exist in the script folder
$Files = @(
"$PSScriptRoot\..\bin\LGPO.exe",
"$PSScriptRoot\..\bin\Microsoft.Windows.SDK.NET.dll",
Expand Down
2 changes: 1 addition & 1 deletion src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ $ScriptFiles = @(
if (($ScriptFiles | Test-Path) -contains $false)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message "There are no files in the bin folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Warning -Message "There are no files in the script folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Information -MessageData "" -InformationAction Continue

Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Expand Down
2 changes: 1 addition & 1 deletion src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);

# Remove firewalled IP addresses that block Microsoft recourses added by harmful tweakers
# https://wpd.app
Get-NetFirewallRule | Where-Object -FilterScript {($_.DisplayName -match "Blocker MicrosoftTelemetry") -or ($_.DisplayName -match "Blocker MicrosoftExtra") -or ($_.DisplayName -match "windowsSpyBlocker")} | Remove-NetFirewallRule
Get-NetFirewallRule -DisplayName "Blocker MicrosoftTelemetry*", "Blocker MicrosoftExtra*", "windowsSpyBlocker*" -ErrorAction Ignore | Remove-NetFirewallRule

Write-Information -MessageData "" -InformationAction Continue
# Extract the localized "Please wait..." string from shell32.dll
Expand Down
2 changes: 1 addition & 1 deletion src/Sophia_Script_for_Windows_11/Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ $ScriptFiles = @(
if (($ScriptFiles | Test-Path) -contains $false)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message "There are no files in the bin folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Warning -Message "There are no files in the script folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Information -MessageData "" -InformationAction Continue

Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);

# Remove firewalled IP addresses that block Microsoft recourses added by harmful tweakers
# https://wpd.app
Get-NetFirewallRule | Where-Object -FilterScript {($_.DisplayName -match "Blocker MicrosoftTelemetry") -or ($_.DisplayName -match "Blocker MicrosoftExtra") -or ($_.DisplayName -match "windowsSpyBlocker")} | Remove-NetFirewallRule
Get-NetFirewallRule -DisplayName "Blocker MicrosoftTelemetry*", "Blocker MicrosoftExtra*", "windowsSpyBlocker*" -ErrorAction Ignore | Remove-NetFirewallRule

Write-Information -MessageData "" -InformationAction Continue
# Extract the localized "Please wait..." string from shell32.dll
Expand Down
2 changes: 1 addition & 1 deletion src/Sophia_Script_for_Windows_11_LTSC_2024/Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ $ScriptFiles = @(
if (($ScriptFiles | Test-Path) -contains $false)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message "There are no files in the bin folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Warning -Message "There are no files in the script folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Information -MessageData "" -InformationAction Continue

Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);

# Remove firewalled IP addresses that block Microsoft recourses added by harmful tweakers
# https://wpd.app
Get-NetFirewallRule | Where-Object -FilterScript {($_.DisplayName -match "Blocker MicrosoftTelemetry") -or ($_.DisplayName -match "Blocker MicrosoftExtra") -or ($_.DisplayName -match "windowsSpyBlocker")} | Remove-NetFirewallRule
Get-NetFirewallRule -DisplayName "Blocker MicrosoftTelemetry*", "Blocker MicrosoftExtra*", "windowsSpyBlocker*" -ErrorAction Ignore | Remove-NetFirewallRule

Write-Information -MessageData "" -InformationAction Continue
# Extract the localized "Please wait..." string from shell32.dll
Expand Down Expand Up @@ -664,7 +664,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Write-Error -Message ($Localization.NoResponse -f "https://github.com") -ErrorAction SilentlyContinue
}

# Check whether all necessary files exist in the bin folder
# Check whether all necessary files exist in the script folder
$Files = @(
"$PSScriptRoot\..\bin\LGPO.exe",
"$PSScriptRoot\..\bin\Microsoft.Windows.SDK.NET.dll",
Expand Down
2 changes: 1 addition & 1 deletion src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ $ScriptFiles = @(
if (($ScriptFiles | Test-Path) -contains $false)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message "There are no files in the bin folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Warning -Message "There are no files in the script folder. Please, re-download the archive and follow the guide: https://github.com/farag2/Sophia-Script-for-Windows?tab=readme-ov-file#how-to-use."
Write-Information -MessageData "" -InformationAction Continue

Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Expand Down

0 comments on commit 0b7300c

Please sign in to comment.