Showing posts with label OSD Automation. Show all posts
Showing posts with label OSD Automation. Show all posts

Automating a Smart Windows 11 Upgrade Using PsExec, PowerShell, and SCCM-Ready Logic

 

Upgrading enterprise devices to Windows 11 at scale requires careful orchestration. Devices must meet hardware requirements, have enough disk space, maintain user productivity, and ensure minimal disruption. This Smart Windows 11 Upgrade solution delivers a fully automated, resilient, and user-aware upgrade workflow using PsExec, batch scripting, and PowerShell automation.

This implementation is designed for enterprise environments, ensuring reliability, fallback mechanisms, logging, and compliance checks before initiating the in-place upgrade (IPU).


  • 🚀 Solution Overview

This solution consists of three major components:

  1. PsExec Launcher (Remote Execution Layer)
  2. Batch Script (Content Distribution & Trigger Layer)
  3. PowerShell Scripts (Logic, Validation & Upgrade Execution)

Together, they create a robust and self-healing upgrade workflow.


  • 🔹 1. Remote Execution Using PsExec

The process begins with:

PowerShell

psexec @file.txt -s -h -d -c -f DC_SmartUpgrade.bat

``

Show more lines

  • Key Features:
  • @file.txt → Targets multiple systems
  • -s → Runs as SYSTEM (highest privilege)
  • -h → Elevated execution
  • -d → Non-blocking execution
  • -c -f → Copies and overwrites the batch script
  • Purpose:

This enables mass deployment of the upgrade trigger across endpoints without requiring manual intervention.


  • 🔹 2. Batch Script – Smart Content Staging

The batch script acts as a resilient launcher and content distributor.

  • Key Capabilities:
  • Multi-Server Fallback

BAT

for %%S in ("%SERVER_SHARE1%" "%SERVER_SHARE2%" "%SERVER_SHARE3%")

Show more lines

Automating Language Pack Installation with PowerShell and SCCM

 

Managing language packs across enterprise devices is often a complex and user-dependent process. This PowerShell-based solution simplifies the entire lifecycle of language pack deployment, from user selection to installation and status tracking, making it scalable and enterprise-ready.

This implementation consists of three coordinated components:

  • Dummy Package Script (initialization and registry setup)
  • User Prompt Script (region/language selection and user interaction)
  • Installation Script (DISM-based language pack deployment)

Together, these scripts provide a complete, automated workflow for multilingual environments.


  • Overview of the Solution

The solution is designed to:

  • Allow users to select region and preferred language
  • Store selections using SCCM task sequence variables and registry
  • Install language packs dynamically using DISM
  • Provide user feedback (success/failure popups)
  • Maintain centralized logging for auditing and troubleshooting

  • 1. Dummy Package Script (Initialization Layer)

The dummy script prepares the environment by ensuring the required registry structure exists.

  • Key Functionality:
  • Creates registry path:
  • HKLM:\SOFTWARE\LPs
  • Initializes logging at:
  • C:\ProgramData\\LogFiles
  • Logs whether the registry path was newly created or already exists
  • Purpose:

This acts as a foundation step to track installation state and user selections consistently across the deployment lifecycle.


  • 2. User Prompt Script (Interactive Layer)

This script provides a Windows Forms-based UI for users to select their region and corresponding language.

  • Key Features:
  • Region-to-Language Mapping
  • Regions (Asia, Europe, America) dynamically populate language options
  • Ensures users only select valid combinations
  • Language Code Mapping

Smart BIOS Upgrade

Automating Dell BIOS Upgrades with PowerShell in an Enterprise Environment

Managing BIOS updates across enterprise devices is often a complex and high-risk task. Firmware updates require careful coordination, user awareness, and strict safeguards such as power checks and version validation. This PowerShell solution addresses those challenges by delivering a fully automated, user-aware BIOS upgrade workflow integrated with Microsoft Configuration Manager (SCCM) task sequences.

This script combines automation, user interaction, validation logic, and a graphical interface to create a reliable and controlled BIOS upgrade process.


Overview of the Solution

The script is designed to handle the entire BIOS upgrade lifecycle, from initial detection to final verification. It performs the following key functions:

  • Detects system model and current BIOS version
  • Compares it against a predefined expected version (via JSON file)
  • Determines whether an upgrade is required
  • Prompts the user with retry options
  • Enforces AC power requirements for laptops
  • Executes the BIOS update silently
  • Displays a real-time progress UI
  • Logs all actions for auditing
  • Verifies success after reboot

This approach ensures both operational efficiency and user safety.


Dynamic BIOS File Handling

The script automatically identifies the BIOS executable located in the same directory. This avoids hardcoding file names and allows the same script package to support multiple models.

By dynamically picking the executable, administrators can easily maintain the solution by simply updating the BIOS files in the folder.


Logging and Traceability

A structured logging mechanism writes all activity to:

C:\ProgramData\GlobalClient\LogFiles

Each device generates a uniquely named log file based on its model. This makes troubleshooting straightforward and ensures full traceability for every upgrade attempt.


User-Friendly Progress Interface

A key highlight of this solution is its custom WPF-based graphical interface. Instead of leaving users unsure about what’s happening, the script displays:

  • A progress bar with percentage completion
  • Status messages indicating current steps
  • A scrolling output log
  • Corporate branding through logo integration

The UI also includes basic window controls like minimize functionality and drag movement, offering a polished and professional experience.


Integration with SCCM Task Sequences

TS Export

function Export-TSToExcel

{

    param (

        [Parameter(ParameterSetName="FromXml", Mandatory)]

        [ValidateNotNullOrEmpty()]

        [xml] $Xml,


        [Parameter(ParameterSetName="FromXmlPath", Mandatory)]

        [ValidateNotNullOrEmpty()]

        [System.IO.FileInfo] $XmlPath,


        [Parameter(ParameterSetName="FromTaskSequence", Mandatory, ValueFromPipeline)]

        [ValidateNotNullOrEmpty()]

        [object] $TaskSequence,


        [Parameter(ParameterSetName="FromTaskSequence")]

        [Parameter(ParameterSetName="FromXml")]

        [Parameter(ParameterSetName="FromXmlPath")]

        [System.IO.FileInfo] $ExportPath,


        [Parameter(ParameterSetName="FromXml")]

        [Parameter(ParameterSetName="FromXmlPath")]

        [string] $TSName = "Task Sequence",


        [Parameter(ParameterSetName="FromTaskSequence")]

        [Parameter(ParameterSetName="FromXml")]

        [Parameter(ParameterSetName="FromXmlPath")]

        [switch] $Show,


        [Parameter(ParameterSetName="FromTaskSequence")]

        [Parameter(ParameterSetName="FromXml")]

        [Parameter(ParameterSetName="FromXmlPath")]

        [switch] $Macro,


        [Parameter(ParameterSetName="FromTaskSequence")]

        [Parameter(ParameterSetName="FromXml")]

        [Parameter(ParameterSetName="FromXmlPath")]

        [switch] $Outline,

        

        [Parameter(ParameterSetName="FromTaskSequence")]

        [Parameter(ParameterSetName="FromXml")]

        [Parameter(ParameterSetName="FromXmlPath")]

        [switch] $HideProgress

    )


    try

Updating the country or region settings in windows 10

Hello Friends,

 

We observed sometimes, we are facing issues while updating the country or region settings in windows 10. Thus, it is important to keep the correct settings. If you can’t change country or region, it might be for one of these reasons:

You changed the country or region within the last three months.

Your account is suspended. For example, the credit card on a subscription has expired, or your subscription has a balance due.

You’re legally a minor in your current country or region and won’t be a minor in the new region, or vice-versa.

 

For more details about country or region settings in Windows 10, refer to the below link.

 

Update Task Sequence, DP info in registry

Hello Friends,

Is there a way I can know which task sequence is used to deploy a particular machine?

Yes, we can update the registry key with the Task Sequence info like, which Task Sequence is used to deploy the OS on a particular machine?

from Which DP the contents are downloaded? Is the machine built with Boot media or it is PXE boot?

Is this a machine desktop or laptop? what is the machine type, machine model?

Also, we can get when the machine is imaged(date and time when the Task Sequence is deployed).

First, we have to gather all the information which we want to update in the registry.

let's take the example of DP's name...

How do we know from which DP the contents are getting downloaded? from where I can get this information? is it a simple variable which I can use to update the registry? No.

While running the Task Sequence all the variable data is stored in a .dat file and we can fetch that using "New-Object -ComObject 'Microsoft.SMS.TSEnvironment"

OSD Driver installation via PowerShell

Today we are going to install the model-specific driver packages using PowerShell script. The advantage of using this method of driver installation during the Operating System deployment is to reduce the overall Task Sequence deployment time, This method is more suitable if you have multiple hardware devices with multiple vendors (Dell, HP, Lenovo, Microsoft, etc...) 

In order to achieve this method follow the below steps. 

1. Create the folder structure as below.
        a. Vendor\Hardware model\

2. Download the specific hardware model driver package from the vendor website and extract the cab files.

3. Archive/Zip all the extracted drivers into one single folder called "Drivers.zip".

4. Copy DISM folder from ADK installed machine and place into the "Vendor\Hardware model\"
path of DISM-(C:\Program Files (x86)\Windows Kits\<version>\Assessment and Deployment Kit\Deployment Tools\10\DISM)

TaskBand customization during TS execution PowerShell Solution

Friends, Hope you are doing well. Today we are going to automate the taskband during the imaging process. We will create the taskband package using Powershell and deploy the package via a task sequence. alternatively, you can use the batch file instead of PowerShell.

What first?

First, we have to log in on the reference machine from where we are capturing the taskband files and settings.

Pin the taskbar items whatever you want😊 as per your org requirement, not blindly😏




go to location "%userprofile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\"

TaskBar Customization during Task Sequence execution Batch Script

There are two ways to customize your TaskBand during the Task Sequence execution.

1. Using PowerShell script

2. Batch Script as described here.

Pin the taskbar items whatever you want😊 as per your org requirement, not blindly😏

go to the location "%userprofile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\" 

copy all the shortcut files from this location and save them to your reference package folder.

for me, I have created one folder on the reference machine desktop named "TaskBandAutomation\Taskbar".

now what next? open registry settings for users and navigate to "Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" and say export and save as TaskBand.reg. where? on your desktop or anywhere you want. anyway, we have to delete this file after getting some info from it.

Make CMTrace as default log viewer during the Imaging process(OSD)

While analyzing the SCCM logs every engineer wants to open log files by default in CMTrace. But When you log in to a new build machine and open the CCM logs or any *.log files from the machine, the log files will open in the notepad by default. Reading the SCCM log files into notepad is very difficult, Microsoft is providing the live log reading tool call CMTrace with the SCCM suite. In this post, we are going to make it the default app for log files. We will create the SCCM package and deploy it via Task Sequence execution while Operating System Deployment step.

To achieve this, create a new package using the below PS1 code and deploy it on required DPs

Cleanup Image before Capture - Event Viewer cleanup batch file

Guys, Why WIM Image cleanup is more important ? This is because it delivers error-free images to the customer and reduces the manufacturer's bugs and issues. While troubleshooting the end-user machine, there should not be previous logs that can create confusion.

If you are going to clean up the event viewer logs one by one manually it will take your whole day and also an irritating job for you. don't worry we have created a simple and easy script that helps you to clean the event viewer logs within a minute.

clean reference images before capturing them in WIM format.


Auto Diskpart and stale entry delete from SCCM during Imaging process

I know many of the build administrators are deploying the Task Sequence on unknown device collection. I purpose and the idea behind it is to do not deploy the task sequence on a production device and prevent accidental data loss.

If the machine is in SCCM collection and we want to run the task sequence on it, we must SCCM Console and do a manual deletion job and wait for a couple of minutes to restart the imaging on the target machine

This is a time-consuming and repetitive task for us. Can we create a way to do this in an automotive way? Like, create the PowerShell Script, which will automatically read the machine's MAC Address and connect to the SCCM database from the WinPE environment for getting all the hostnames to hold by that mac address and delete each.

Also, can we do a diskpart at the same time to avoid further imaging failure? Yes we can create the PowerShell Script and integrate it with Boot Image, which will automatically check whether the machine having an internal storage device attached or not, and based on the results script will perform Diskpart operation, if the internal storage device is faulty or not connected in BIOS, the script will prompt the error.

Image Validation Script used in TS execution, OSD validation

Hello Friends,

As a build administrator, post Operating system deployment, Image Validation is a very very important task. There are multiple parameters we have to check post OS installation.
Like, we have to check each and every application installed on the machine and also check the version of each application, whether it's installed correctly or not?

We have to check whatever the patches we have targeted to the device are installed properly or not?

Sometimes we are getting requirements from clients saying that we have to set some services in disabled mode and some services we need to set as an automatic start. These services' startup type and status should be the same as we configured before executing Task Sequence or while capturing the WIM file.

Manual drivers validation is again a very difficult task, why not capture all the drivers installed on the machine and save it in the same CSV file for further validation.

AD Authentication PowerShell script.

 Hello friends, In some scenarios tech guys have to provide their username and password to join the machine into the domain. and Task Sequence wants to store the info somewhere before execute the actual domain join step.

I have seen the problem, that sometimes builds engineers are not providing the correct username and password to the TS and the domain join step is getting failed due to incorrect username and password.

Don't worry! this is a common issue with anyone and we can fix it by checking the user is present on AD and will authenticate him at the same time when he provides the credential details to the Task Sequence.

How?

Domain join is failed due to network unavailability during TS execution

Hello friends,

Domain join is the most important step in the Task Sequence. If the domain join does not happen, there is no value to execute the task sequence ahead. Because if we missed joining the domain during the task sequence execution, the domain users can not log in to the machine and we have to reimage the machine again, simply this waste of time.

Here is one important thing we have to note down, this step is not failing anyhow. So, if the domain join is failed even. Still, a task sequence will execute the next step.

We only know that domain join is failed while login in the machine post-task sequence completes.

Why is domain join fail sometimes?

We are joining the machines to the domain once driver installation is done (before first reboot the machine). We observed post drivers’ installation sometimes network drivers loos the connectivity and this is causing the domain join failure.

User base Drivers installation - Max Audio Pro For Dell

User base drivers?

yes, We have some drivers which need to be installed in the users' contexts.

This post is not about the driver's installation but moreover about installing any package which is purely created for the user. 

The below script will install the user base "Max Audio Pro For Dell" drives post Task Sequence execution and on first-time users login into the machine.

We have to place the whole setup file along with the below script on the target machine for user base installation post Task Sequence.

The trigger.bat we have to create with the script code:

MKDIR "C:\ProgramData\OSD_MaxAudio"

xcopy.exe ".\*.*" "C:\ProgramData\OSD_MaxAudio" /D /E /C /I /Q /H /R /Y /S

Services management during OSD Task Execution

Hello Friends, During the OSD Task Sequence execution process, We have to disable and stop some services, or sometimes we have to enable and start the services from Windows services.msc console.

We can use cmdlet from PowerShell "set-service" to manage the services on the windows operating system.

To manage the bunch of services during Task Sequence execution, We have created the below PowerShell script and managed some of the services. you can change the service name and startup type as per your requirement.

also, you can use this PowerShell script before capture the WIM file or it can be used during the TS execution time. in both scenarios, we can manage the services.

Services management during OSD Task Execution
Use the below script to manage the services during OSD.

Inject the Drivers during Task Sequence execution via Auto IT Script

Hello Friends, Here is another way to inject the drivers is based on the hardware mode. This time we are using the AutoIT script solution to create the script and us in the Task Sequence.

In order to achieve this method follow the below steps. 

1. Create the folder structure as below.

        a. Vendor\Hardware model\

2. Download the AutoIT script editor here and install it on your machine.

3. Write the below script in the "SciTE Script Editor" located  at C:\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3

Inject the Drivers during Task Sequence execution via Auto IT Script


4. Save the file as InjectDrivers.au3

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.