Remove Windows10 bloatware from WIM using PowerShell

The logic behind writing this script is to remove unwanted built-in apps from Windows 10 1909 Operating System. This script can be used to remove Windows 10 built-In Apps in OS as well as in Task Sequence Deployment.

You can mention the list of applications to remove from the OS, based on your business requirement.

<#

    .SYNOPSIS

    Removing Windows 10 1909 Built-In Apps.

    .DESCRIPTION

   

    .NOTES

    =============================================================================================================================================

    Created with:     Windows PowerShell ISE

    Created on:       Wednesday, October 6, 2021 5:41:31 PM

    Created by:       Dashrath Chate

 

Create batch file to replace xml file restart app service and create detection rule

Hello friends, there are a lot of customized XML files we are using in the WIM and even during the Task Sequence execution. like startlayout.xml, defaultAppAssociation.xml, UDIWizard.xml.

Sometimes we are creating custom application installation through UDI Wizard using XML, some application settings need to overwrite using an XML file.

post OSD, technicians can’t copy-paste each and every XML file into the application install directory and there are chances of mistakes and can lead to a functionality break.

To overcome this issue, we can replace the application-related XML files safely during the Task sequence execution.

you have to customize your XML file and create a package along with one batch script inside it.

the batch file will act as a trigger while executing the action and use the %~dp0 functionality before the XML file name to replace the existing XML file from the package source directory. to overwrite the existing XML, we have to use the /y switch at the end of xcopy command.

Create local admin account with password during task sequence execution

What if the machine gets failed during the task sequence execution and not joined the domain too? How to login machine for further troubleshooting?? Is there any mechanism to create a local admin account??? (there are so many organizations not enabling the built-in administrator for security purposes)?

Yes, we can create the custom local administrator account and add them to the local administrators’ group. Also, we can set the password expiry - wmic useraccount where name='localadmin' set passwordexpires=false and password to the account - net user /add localadmin P@$$W)rd (you can choose a local admin username and password as per your requirement).

This script is more important because there is one default function also available in TS to use the built-in administrator or rename and use it. Then why we are putting extra effort and using this script?

The advantage is we are not creating the local administrator account if everything goes well, instead of, if domain join is failed then only, we are going to create custom local account to enable to local login functionality and help technician to gather the logs and take further action.