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\"







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.





Now, What?>We have to get the registry DROWD and BINARY value from TaskBand.reg.

How?> right-click on TaskBand.reg and open with notepad copy "FavoritesRemovedChanges", "FavoritesChanges", "FavoritesVersion" registry name and value too ! repeat the same for BINARY as well !!

Well done!!!! now create a new PowerShell and insert the below code into it.

and replace the value copied from the TaskBand.reg. Save the PS1 as TaskBand.ps1

Our package is ready and let's open the SCCM console and create the SCCM package without a program and deploy it on the required DPs.
















Open Task Sequence and add new folder post-WinPE Stage - "TaskBand" Add -General -New command line named -'TaskBand_copy" and add command -"xcopy.exe ".\*.*" "C:\ProgramData\TaskBand" /D /E /C /I /Q /H /R /Y /S" 

Give the "TaskBand" reference package to "TaskBand_copy" step.

Again, Add -General -New command line named -'TaskBand_SetCommand" and add command -"REG ADD "HKLM\Software\Microsoft\Active Setup\Installed Components\TaskBand" /v StubPath /t Reg_SZ /d "PowerShell.exe -file C:\ProgramData\TaskBand\Taskband.ps1 -executionpolicy bypass -WindowsStyle Hidden" /f"










all done!!! Save the Task Sequence and deploy on reference machine 😄

<><><><><><><><><><><><><><><><><><><><><>

  <#

 

    .SYNOPSIS

 

        TaskBand customization during TS execution.

 

    .DESCRIPTION

 

        This is a common task we have to perform during the imaging process and customize the taskbar as per customers requirements

 

    .NOTES

 

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

 

        Created with:     Windows PowerShell ISE

 

        Created on:       Thursday, September 16, 2021 9:44:20 PM

 

        Created by:       Dashrath Chate

 

        Organization:     Blogger.com

 

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

 

#>

 

if (Test-Path "$env:APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar")

 

    {Copy-Item "$PSScriptRoot\Taskbar\*.*" "$env:APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\" -Force -Confirm:$false}

 

    else

 

        {

 

        New-Item "$env:APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar" -Force -ItemType Directory

 

        Copy-Item "$PSScriptRoot\Taskbar\*.*" "$env:APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\" -Force -Confirm:$false

 

        }

 

#Use this section to validate the changes in the registry post you deployed via task Sequence"

 

$FavoritesChanges = "81" # Provide the exact value HERE which is created while deploying the TaskBand settings

 

 

 

$GetFavoritesChanges = (Get-ItemPropertyValue -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband -Name FavoritesChanges)

 

If ($FavoritesChanges-eq $FavoritesChanges)

 

{Write-Output "TaskBand is already configured successfully"}

 

else

 

{

 

$HexaValueFavoritesResolve = "12,34,56,78,90" # In this format - "12,34,56,78,90"

 

$HexaRegReadableFavoritesResolve = $HexaValueFavoritesResolve.Split(',') | % { "0x$_"}

 

 

 

$FavoritesResolve1 = "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband"

 

New-ItemProperty -Path $FavoritesResolve1 -Name FavoritesResolve2 -Value ([byte[]]$HexaRegReadableFavoritesResolve) -PropertyType binary -Force

 

 

 

$HexaValueFavorites = "12,34,56,78,90" # In this format - "12,34,56,78,90"

 

$HexaRegReadableFavorites = $HexaValueFavorites.Split(',') | % { "0x$_"}

 

 

 

$FavoritesResolve2 = "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband"

 

New-ItemProperty -Path $FavoritesResolve2 -Name FavoritesResolve2 -Value ([byte[]]$HexaRegReadableFavorites) -PropertyType binary -Force

 

New-ItemProperty -Path Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband -PropertyType DWORD -Value 3 -Name FavoritesVersion

 

New-ItemProperty -Path Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband -PropertyType DWORD -Value $RegistryValue -Name FavoritesChanges

 

New-ItemProperty -Path Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband -PropertyType DWORD -Value 15 -Name FavoritesRemovedChanges    

}

No comments:

Post a Comment

Leave your valuable words here for improve better.