Collection of PowerShell scripts to automate initial setup of a new Windows computer and remove common pre-installed "bloatware" applications. These are example scripts intended for IT use and testing. Review and adapt them to your environment before running. Each script can run independently of each other.
New_Computer_Setup.ps1— Automates common post-imaging tasks: rename computer, join a domain, add a domain group to local Administrators, install applications via Chocolatey, configure a few system settings, and print a summary. Prompts for input where required.bloatware_removal.ps1— Removes a set of pre-installed Microsoft Store apps and (optionally) OneDrive. Requires administrative privileges.
- Open PowerShell as Administrator.
- (Optional) Set execution policy for the current session and run the script you want.
To run the bloatware removal script:
Set-ExecutionPolicy Bypass -Scope Process -Force
.\bloatware_removal.ps1To run the new computer setup script:
Set-ExecutionPolicy Bypass -Scope Process -Force
.\New_Computer_Setup.ps1Note: Both scripts attempt to self-elevate when not run as Administrator. Still, running PowerShell as Administrator before invoking them avoids an extra elevation prompt.
- Windows 10 / 11 (or Windows Server where Get-AppxPackage / Get-AppxProvisionedPackage are relevant).
- Administrative privileges (scripts will attempt to elevate).
- Internet access to install Chocolatey and packages (for
New_Computer_Setup.ps1). - Chocolatey is installed by the setup script if missing. You can skip that step if you prefer to manage Chocolatey separately.
bloatware_removal.ps1:
- Contains a list of Appx packages to remove (examples: Clipchamp, GetHelp, Xbox components, Solitaire, Feedback Hub).
- Calls
Get-AppxPackageandRemove-AppxPackageto remove the packages for the current user andGet-AppxProvisionedPackage/Remove-AppxProvisionedPackage -Onlineto remove provisioned packages. - Checks for OneDrive at
%SystemRoot%\SysWOW64\OneDriveSetup.exe,%SystemRoot%\System32\OneDriveSetup.exe, and will run the uninstall switch if present.
New_Computer_Setup.ps1:
- Prompts for a new computer name and a domain to join. Calls
Rename-ComputerandAdd-Computer(will prompt for credentials and may require a restart). - Prompts for a domain group to add to the local
Administratorsgroup and callsAdd-LocalGroupMember. - Installs Chocolatey (if missing) and then installs a list of apps defined in the
$appsarray (googlechrome,keepass,googledriveby default). - Configures a few example system settings: power plan, disables hibernation, sets time zone.
- Edit the list of bloatware in
bloatware_removal.ps1($bloatwarearray) to add/remove applications you want to target. - In
New_Computer_Setup.ps1change the$appsarray to include the Chocolatey packages you want installed. - Uncomment or modify additional sections (e.g., wallpaper, chocolatey uninstall) as needed. Lines that are intentionally commented are labeled in the script.
- Change timezone in the
tzutil /s "Eastern Standard Time"line to your preferred timezone.
- Always review scripts before running. These scripts make system-level changes (rename, domain join, package removal, uninstallers).
- Test in a virtual machine or a non-production device first.
- Backup important data and create a system restore point or image before mass changes.
- When joining a domain, be certain you have appropriate domain admin credentials and that a restart is acceptable.
- Chocolatey install fails: check network/proxy settings and ensure TLS 1.2 is available. The script enables TLS 1.2 when invoking the installer.
- Appx packages not found: some packages are not installed for every image or may have different package names. Adjust the
$bloatwarearray or runGet-AppxPackage -AllUsersto inspect installed packages. - OneDrive uninstall not found: the script looks for
%SystemRoot%\SysWOW64\OneDriveSetup.exeand%SystemRoot%\System32\OneDriveSetup.exe; OneDrive may be located elsewhere.
These scripts are provided as examples and are intended for use by system administrators. Use at your own risk. The author(s) are not responsible for data loss or system misconfiguration caused by these scripts.
No license specified.
// Created: 2025/09/26 08:00:00 // Last Modified: 2025/10/06 10:45:00