How to Run Win11Debloat for Other Users: CLI and GUI Methods
Win11Debloat supports targeting different local user accounts via the -User parameter in CLI mode or the "Other User" selection in the GUI, automatically resolving profile paths through the GetUserDirectory function.
The Win11Debloat script from the Raphire/Win11Debloat repository is designed to clean and customize Windows 11 installations. While it defaults to the currently logged-on account, you can run Win11Debloat for other users by leveraging built-in switches that redirect all registry modifications, app removals, and Start Menu changes to a specific target profile.
Using the Command-Line Interface (CLI)
The most direct method to run Win11Debloat for other users is passing the -User switch when invoking the main script. In Win11Debloat.ps1, the GetUserName function (lines 367-373) checks for this parameter and overrides the default $env:USERNAME value.
When supplied, the script resolves the target profile path via GetUserDirectory (lines 377-410), ensuring that all user-specific actions—such as registry imports, Start Menu replacements, and application removals—operate on the correct directory structure.
To debloat another account from the command line:
# Remove default apps for user "jdoe"
.\Win11Debloat.ps1 -User jdoe -RemoveApps
# Apply full defaults plus telemetry disable for another user
.\Win11Debloat.ps1 -User jdoe -RunDefaults -RemoveApps -DisableTelemetry
# Replace Start Menu layout for a specific user only
.\Win11Debloat.ps1 -User jdoe -ReplaceStart "C:\MyStartMenu\start2.bin"
Using the Graphical User Interface (GUI)
For those preferring a visual workflow, the GUI provides a User Selection combo-box that supports targeting accounts interactively. Located in Scripts/GUI/Show-MainWindow.ps1 (lines 24-46), this interface element offers an "Other User" option that reveals a text input panel.
The validation logic resides in Win11Debloat.ps1 within the CheckIfUserExists function (lines 415-428), which verifies the entered username against local accounts before proceeding.
To use the GUI method:
- Launch the script by double-clicking
Run.bator running.\Win11Debloat.ps1without parameters. - Click the User Selection drop-down in the top-right and select Other User.
- Enter the target username (e.g.,
jdoe) in the panel that appears. A green "User found" confirmation indicates successful validation. - Select your desired debloat options and click Apply to execute changes against the specified profile.
How User Targeting Works Under the Hood
Both CLI and GUI methods feed into the same backend architecture. The chosen username is stored in $script:Params["User"], which centralizes the active user identity for the entire execution context.
When -User is specified, GetUserName returns the provided value instead of the current session's username. Consequently, all feature modules—whether removing bloatware, importing registry files, or replacing Start Menu binaries—automatically resolve paths through GetUserDirectory to target the specified user's %USERPROFILE% instead of the administrator's.
This design is independent of Sysprep mode (-Sysprep), which targets the Default user template for new account provisioning. The -User switch specifically operates against existing local accounts and is safe for any profile not currently in active use.
Practical Examples for Common Scenarios
Full System Debloat for Another Account
Execute a comprehensive cleanup on a colleague's or family member's profile while logged in as administrator:
.\Win11Debloat.ps1 -User jdoe -RunDefaults -RemoveApps -DisableTelemetry -DisableOnedrive
Isolated Start Menu Customization
Deploy a standardized Start Menu layout to a specific user without affecting other profiles:
.\Win11Debloat.ps1 -User jdoe -ReplaceStart "C:\CompanyTemplates\standard_start.bin"
Registry-Only Modifications
Apply privacy-focused registry tweaks to another user's hive:
.\Win11Debloat.ps1 -User jdoe -DisableTelemetry -DisableSuggestions
Summary
- CLI Method: Append
-User <username>to anyWin11Debloat.ps1invocation; theGetUserNameandGetUserDirectoryfunctions inWin11Debloat.ps1handle path resolution automatically. - GUI Method: Select Other User from the User Selection combo-box in
Show-MainWindow.ps1, validated byCheckIfUserExists. - Both interfaces populate
$script:Params["User"], ensuring consistent behavior across app removal, registry edits, and Start Menu replacement. - The
-Userparameter targets existing local accounts and functions independently from-Sysprepmode.
Frequently Asked Questions
Can I run Win11Debloat for a user that is currently logged off?
Yes. The script resolves the user profile path through GetUserDirectory based on the local account database and registry hive locations, not the active session state. As long as the user profile exists on the system, Win11Debloat can modify it regardless of login status.
Does the -User parameter work with Sysprep mode?
No. The -Sysprep switch targets the Default user template specifically designed for imaging and new account creation. The -User parameter is intended for existing local accounts and operates independently from Sysprep mode according to the source code implementation.
What happens if I enter a non-existent username in the GUI?
The CheckIfUserExists function (lines 415-428 in Win11Debloat.ps1) validates the input against local accounts. If the username does not exist, the GUI displays a validation error and prevents execution until a valid local username is provided.
Are administrator privileges required when targeting other users?
Yes. Modifying another user's registry hive and profile directory requires elevated privileges. Run PowerShell or Run.bat as Administrator before executing Win11Debloat with the -User switch to ensure proper access to the target profile's %USERPROFILE% and NTUSER.DAT.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →