In this post, I’ll walk through a real-world example: enforcing the taskbar alignment on Windows 11 devices. While seemingly minor, consistent UI configurations can help standardize user experiences across the enterprise – especially in environments with strict UX or branding guidelines. We’ll use a detection script to check alignment, and a remediation script to set it if needed – all fully automated via Intune.
Detection Script
<#
Script: Win11Taskbar Alignment Detection Script
Author: Daniel Fraubaum
Version: 0.1
Description: Intune Remediation detection script, Checks if the Windows 11 taskbar is already aligned to the left. If so, exits silently.
#>
####################################################################
# parameters
####################################################################
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
$regValue = "TaskbarAl"
####################################################################
# Test-RegistryValue
####################################################################
function Test-RegistryValue {
param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]$Path,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]$Value
)
try {
Get-ItemProperty -Path $Path | Select-Object -ExpandProperty $Value -ErrorAction Stop | Out-Null
return $true
} catch {
return $false
}
}
####################################################################
# Only run on Windows 11
####################################################################
if (-not ((Get-CimInstance Win32_OperatingSystem).Caption -like "*Windows 11*")) {
Exit 0
}
####################################################################
# If registry key exists and taskbar is already aligned left, do nothing
####################################################################
if (Test-RegistryValue -Path $regPath -Value $regValue) {
if ((Get-ItemProperty -Path $regPath -Name $regValue).$regValue -eq 0) {
Exit 0
}
} else {
Exit 1
}
#end
Remediation
<#
Script: Win11Taskbar Alignment Remediation Script
Author: Daniel Fraubaum
Version: 0.1
Description: Intune Remediation script. Forces the Windows 11 taskbar alignment to the left.
#>
####################################################################
# parameters
####################################################################
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
$regValue = "TaskbarAl"
$regData = 0 # 0 = left, 1 = center
####################################################################
# Test-RegistryValue
####################################################################
function Test-RegistryValue {
param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]$Path,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]$Value
)
try {
Get-ItemProperty -Path $Path | Select-Object -ExpandProperty $Value -ErrorAction Stop | Out-Null
return $true
} catch {
return $false
}
}
####################################################################
# Set taskbar alignment to left
####################################################################
if (Test-Path $regPath) {
try {
Set-ItemProperty -Path $regPath -Name $regValue -Value $regData -Force
Exit 0
} catch {
Exit 1
}
} else {
Exit 1
}
#end
With Intune Remediations, enforcing small but important UI standards like taskbar alignment becomes easy, scalable, and fully automated. This approach reduces manual effort for IT, ensures consistency across devices, and provides a better-managed user experience overall.
Leave a Reply