-
-
Notifications
You must be signed in to change notification settings - Fork 924
Automation
All of the functionality offered by Win11Debloat is available right from the command line. This allows you to not only run Win11Debloat directly from Powershell, but also integrate it in your existing setup/configuration scripts or automate it using Task Scheduler. Below you can find a few different examples on how Win11Debloat can be used.
Tip
Check out this page for a full list of all parameters that are supported by Win11Debloat.
This example will automatically download and run the latest version of Win11Debloat. 4 parameters are passed to the script in this example: -Silent
to ensure the script runs without requiring any user input, -CreateRestorePoint
ensures a restore point is created before execution, -RemoveApps
removes the default selection of bloatware apps, and -DisableTelemetry
disables telemetry.
& ([scriptblock]::Create((irm "https://debloat.raphi.re/"))) -Silent -CreateRestorePoint -RemoveApps -DisableTelemetry
This example starts a new powershell process where the script is executed in a hidden window. The process points to the script at C:\Win11Debloat\Win11Debloat.ps1
. The script is run with 2 parameters: -Silent
to ensure the script runs without requiring any user input, and -RunDefaults
which runs the default settings automatically. -Verb RunAs
ensures the command is run as administrator.
Start-Process powershell.exe -PassThru -ArgumentList "-executionpolicy bypass -WindowStyle Hidden -File C:\Win11Debloat\Win11Debloat.ps1 -Silent -RunDefaults" -Verb RunAs
This example will use Task Scheduler to execute Win11Debloat. Task Scheduler is a built-in Windows utility that allows users to automate the execution of scripts, programs, or tasks at specified times or events. In the case of this example we'll create a basic task that runs when you sign in.
First, open Task Scheduler and create a basic task
Choose a name for the task
Set the start trigger to 'When I log on' to ensure the script is run after the user logs on.
Set action type to Start a program
.
Set program to powershell.exe
, and set arguments to the script file path and add any parameters you want to use at the end, with spaces in between. Below are a few different options. For these examples the script is run with the -Silent
and -RunDefaults
parameters.
Option 1
Run the script using a locally saved copy at C:\Win11Debloat\Win11Debloat.ps1
.
"C:\Win11Debloat\Win11Debloat.ps1" -RunDefaults -Silent
Option 2
Run the script in a hidden window, using a locally saved copy at C:\Win11Debloat\Win11Debloat.ps1
.
-WindowStyle Hidden "C:\Win11Debloat\Win11Debloat.ps1" -RunDefaults -Silent
Option 3
Automatically download & run the latest version of the script.
& ([scriptblock]::Create((irm "https://debloat.raphi.re/"))) -RunDefaults -Silent
Next, make sure to tick Open the Properties dialog for this task when I click Finish
, then click Finish
.
Now the Properties window will open, make sure to select the correct user here and tick Run with highest privileges
.
And you're done! The script should now automatically run every time you log on.