Browse Source

Improved error handling

master
Dmitry Nefedov 3 weeks ago
parent
commit
b84ae302e1
  1. 3
      .github/workflows/Sophia.yml
  2. 11
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  3. 13
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  4. 11
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  5. 11
      src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1
  6. 13
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

3
.github/workflows/Sophia.yml

@ -105,8 +105,7 @@ jobs:
echo "RELEASE_NAME=$ReleaseName" >> $env:GITHUB_ENV echo "RELEASE_NAME=$ReleaseName" >> $env:GITHUB_ENV
- name: Uploading - name: Uploading
# https://github.com/softprops/action-gh-release/issues/556#issuecomment-2556947371 uses: softprops/action-gh-release@master
uses: softprops/action-gh-release@v2.1.0
with: with:
name: ${{ steps.read_release.outputs.RELEASE_NAME }} name: ${{ steps.read_release.outputs.RELEASE_NAME }}
token: ${{ github.token }} token: ${{ github.token }}

11
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -11388,20 +11388,11 @@ function UninstallUWPApps
# The -PackageTypeFilter Bundle doesn't contain these packages, and we need to add manually # The -PackageTypeFilter Bundle doesn't contain these packages, and we need to add manually
$Packages = @( $Packages = @(
# Spotify
"SpotifyAB.SpotifyMusic",
# Disney+
"Disney.37853FC22B2CE",
# Outlook # Outlook
"Microsoft.OutlookForWindows", "Microsoft.OutlookForWindows",
# Microsoft Teams # Microsoft Teams
"MSTeams", "MSTeams"
# Microsoft Copilot
"Microsoft.Windows.Ai.CoPilot.Provider"
) )
foreach ($Package in $Packages) foreach ($Package in $Packages)
{ {

13
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -581,7 +581,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{ {
(Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess
} }
catch [Microsoft.Management.Infrastructure.CimException] catch [System.Management.Automation.RemoteException]
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
@ -11418,20 +11418,11 @@ function UninstallUWPApps
# The -PackageTypeFilter Bundle doesn't contain these packages, and we need to add manually # The -PackageTypeFilter Bundle doesn't contain these packages, and we need to add manually
$Packages = @( $Packages = @(
# Spotify
"SpotifyAB.SpotifyMusic",
# Disney+
"Disney.37853FC22B2CE",
# Outlook # Outlook
"Microsoft.OutlookForWindows", "Microsoft.OutlookForWindows",
# Microsoft Teams # Microsoft Teams
"MSTeams", "MSTeams"
# Microsoft Copilot
"Microsoft.Windows.Ai.CoPilot.Provider"
) )
foreach ($Package in $Packages) foreach ($Package in $Packages)
{ {

11
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -10584,20 +10584,11 @@ function UninstallUWPApps
# The -PackageTypeFilter Bundle doesn't contain these packages, and we need to add manually # The -PackageTypeFilter Bundle doesn't contain these packages, and we need to add manually
$Packages = @( $Packages = @(
# Spotify
"SpotifyAB.SpotifyMusic",
# Disney+
"Disney.37853FC22B2CE",
# Outlook # Outlook
"Microsoft.OutlookForWindows", "Microsoft.OutlookForWindows",
# Microsoft Teams # Microsoft Teams
"MSTeams", "MSTeams"
# Microsoft Copilot
"Microsoft.Windows.Ai.CoPilot.Provider"
) )
foreach ($Package in $Packages) foreach ($Package in $Packages)
{ {

11
src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1

@ -10057,20 +10057,11 @@ function UninstallUWPApps
# The -PackageTypeFilter Bundle doesn't contain these packages, and we need to add manually # The -PackageTypeFilter Bundle doesn't contain these packages, and we need to add manually
$Packages = @( $Packages = @(
# Spotify
"SpotifyAB.SpotifyMusic",
# Disney+
"Disney.37853FC22B2CE",
# Outlook # Outlook
"Microsoft.OutlookForWindows", "Microsoft.OutlookForWindows",
# Microsoft Teams # Microsoft Teams
"MSTeams", "MSTeams"
# Microsoft Copilot
"Microsoft.Windows.Ai.CoPilot.Provider"
) )
foreach ($Package in $Packages) foreach ($Package in $Packages)
{ {

13
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -568,7 +568,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{ {
(Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess
} }
catch [Microsoft.Management.Infrastructure.CimException] catch [System.Management.Automation.RemoteException]
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
@ -10614,20 +10614,11 @@ function UninstallUWPApps
# The -PackageTypeFilter Bundle doesn't contain these packages, and we need to add manually # The -PackageTypeFilter Bundle doesn't contain these packages, and we need to add manually
$Packages = @( $Packages = @(
# Spotify
"SpotifyAB.SpotifyMusic",
# Disney+
"Disney.37853FC22B2CE",
# Outlook # Outlook
"Microsoft.OutlookForWindows", "Microsoft.OutlookForWindows",
# Microsoft Teams # Microsoft Teams
"MSTeams", "MSTeams"
# Microsoft Copilot
"Microsoft.Windows.Ai.CoPilot.Provider"
) )
foreach ($Package in $Packages) foreach ($Package in $Packages)
{ {

Loading…
Cancel
Save