Sycnex / Windows10Debloater

Script to remove Windows 10 bloatware.
MIT License
18.13k stars 2.04k forks source link

Removal of admin check has broken WPF controls #37

Closed cjastone closed 6 years ago

cjastone commented 6 years ago

In the most recent revision, the following line was removed:

Add-Type -AssemblyName PresentationCore,PresentationFramework

Unfortunately, this breaks WPF, meaning the script does nothing now! If I remove this line:

$ErrorActionPreference = 'silentlycontinue'

...the script produces a number of errors:

Unable to find type [Windows.MessageBoxButton].
At C:\Scripts\Windows10Debloater\Windows10Debloater.ps1:488 char:11
+ $Button = [Windows.MessageBoxButton]::YesNoCancel
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Windows.MessageBoxButton:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

Unable to find type [Windows.MessageBoxImage].
At C:\Scripts\Windows10Debloater\Windows10Debloater.ps1:489 char:13
+ $ErrorIco = [Windows.MessageBoxImage]::Error
+             ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Windows.MessageBoxImage:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

Unable to find type [Windows.MessageBoxImage].
At C:\Scripts\Windows10Debloater\Windows10Debloater.ps1:490 char:9
+ $Warn = [Windows.MessageBoxImage]::Warning
+         ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Windows.MessageBoxImage:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

Unable to find type [Windows.MessageBox].
At C:\Scripts\Windows10Debloater\Windows10Debloater.ps1:503 char:12
+ $Prompt1 = [Windows.MessageBox]::Show($Ask,"Debloat or Revert",$Butto ...
+            ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Windows.MessageBox:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

Reinserting the Add-Type -AssemblyName PresentationCore,PresentationFramework resolves this issue.

Otherwise a great script - keep up the top work!

Sycnex commented 6 years ago

Wow! Thanks for catching that. I added it back in.