Raphire / Win11Debloat

A simple, easy to use PowerShell script to remove pre-installed apps from Windows, disable telemetry, remove Bing from Windows search as well as perform various other changes to declutter and improve your Windows experience. This script works for both Windows 10 and Windows 11.
MIT License
14.2k stars 615 forks source link

Error running script in MDT deployment #159

Open joebananas10 opened 1 day ago

joebananas10 commented 1 day ago

During a MDT deployment,k to a newly imaged computer i get multiple errors. The error items below are from the BDD.log file. I end up with these errors when the script is run with the following commandline option, -RunDefaults -Sysprep -Silent

The last error which references the line "+ reg import "$PSScriptRoot\Regfiles\$path"" repeats multiple times.


+ if ((Get-AppxPackage -Name "*Microsoft.DesktopAppInstaller*") -and (( ...
+      ~~~~~~~~~~~~~~~]LOG]!><time="16:55:14.000+000" date="11-20-2024" component="TaskSequencePSHost" context="" type="3" thread="" file="TaskSequencePSHost">
<![LOG[NotSpecified: (:) [], TypeInitializationException]LOG]!><time="16:55:14.000+000" date="11-20-2024" component="TaskSequencePSHost" context="" type="3" thread="" file="TaskSequencePSHost">
<![LOG[Exception calling "SetBufferContents" with "2" argument(s): "The method or operation is not implemented."]LOG]!><time="16:55:14.000+000" date="11-20-2024" component="TaskSequencePSHost" context="" type="3" thread="" file="TaskSequencePSHost">
<![LOG[At line:4 char:1
+ $RawUI.SetBufferContents(
+ ~~~~~~~~~~~~~~~~~~~~~~~~~]LOG]!><time="16:55:14.000+000" date="11-20-2024" component="TaskSequencePSHost" context="" type="3" thread="" file="TaskSequencePSHost">
<![LOG[NotSpecified: (:) [], MethodInvocationException]LOG]!><time="16:55:14.000+000" date="11-20-2024" component="TaskSequencePSHost" context="" type="3" thread="" file="TaskSequencePSHost">
<![LOG[The operation completed successfully.]LOG]!><time="16:55:50.000+000" date="11-20-2024" component="TaskSequencePSHost" context="" type="3" thread="" file="TaskSequencePSHost">
<![LOG[At \\HCAWDS05\DeploymentShare$\Scripts\HCA_Scripts\23H2-01\Win11Debloat\Win11Debloat.ps1:529 char:9
+         reg import "$PSScriptRoot\Regfiles\$path"
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]LOG]!><time="16:55:50.000+000" date="11-20-2024" component="TaskSequencePSHost" context="" type="3" thread="" file="TaskSequencePSHost">
<![LOG[NotSpecified: (The operation completed successfully.:String) [], RemoteException]LOG]!><time="16:55:50.000+000" date="11-20-2024" component="TaskSequencePSHost" context="" type="3" thread="" file="TaskSequencePSHost">
<![LOG[]LOG]!><time="16:55:50.000+000" date="11-20-2024" component="TaskSequencePSHost" context="" type="3" thread="" file="TaskSequencePSHost">
<![LOG[At \\HCAWDS05\DeploymentShare$\Scripts\HCA_Scripts\23H2-01\Win11Debloat\Win11Debloat.ps1:529 char:9
+         reg import "$PSScriptRoot\Regfiles\$path"
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]LOG]!><time="16:55:50.000+000" date="11-20-2024" component="TaskSequencePSHost" context="" type="3" thread="" file="TaskSequencePSHost">
<![LOG[NotSpecified: (:String) [], RemoteException]LOG]!><time="16:55:50.000+000" date="11-20-2024" component="TaskSequencePSHost" context="" type="3" thread="" file="TaskSequencePSHost">
<![LOG[The operation completed successfully.]LOG]!><time="16:55:50.000+000" date="11-20-2024" component="TaskSequencePSHost" context="" type="3" thread="" file="TaskSequencePSHost">
<![LOG[At \\HCAWDS05\DeploymentShare$\Scripts\HCA_Scripts\23H2-01\Win11Debloat\Win11Debloat.ps1:529 char:9
+         reg import "$PSScriptRoot\Regfiles\$path"```
Raphire commented 17 hours ago

Heya,

I edited your comment to format the error message better.

From the logs it seems like importing the registry files worked as intended. It shows The operation completed successfully.. Which is what it would print when run normally.

Not sure about the first error referencing Get-AppxPackage though.

Are the changes not applying as expected? If so, what changes specifically are not working?

joebananas10 commented 14 hours ago

Some changes are definitely implemented but I don't know what's missing. I can't tell what the " ((Get-AppxPackage -Name "Microsoft.DesktopAppInstaller") " line is applying to, to know if I'm missing anything.

Can you add a command line option to suppress the "The operation completed successfully" messages? I think I remember that in powershell it's possible to pipe the output of a command to null to suppress messages. are you familiar with that?

Do you have any thoughts on the error line that reads "[Exception calling "SetBufferContents" with "2" argument(s): "The method or operation is not implemented."". That seems like a powerhell version problem to me but I'm not able to change the powershell version of my WDS servers. They are all running Server 2019, and have PS version 5.1.26100.1

Lastly, unrelated to the error message but it seems the -RunDefaults command line parameter may be also including the -ClearStartAllUsers or -ClearStart options. is there a way to prevent this?