How to move the taskbar in Windows 11?
Windows 11 currently does not have the option to change the taskbar location in the settings dialog.
To simplify changing this value, you can use the following PowerShell to modify registry setting:
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3
The valid values are the following.
- Left: 00
- Top: 01
- Right: 02
- Bottom: 03
1/ PowerShell function that checks the current taskbar location against a desired location and updates the registry if they do not match:
function Get-TaskbarLocation {
$Settings = (Get-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3 -Name Settings).Settings
$bit = $Settings[12]
switch ($bit) {
0x00 { return "left" }
0x02 { return "right" }
0x01 { return "top" }
0x03 { return "bottom" }
default { return "unknown" }
}
}
# Function to log messages to a log file
function Write-Log {
param(
[string]$Message
)
$logFile = Join-Path -Path $PSScriptRoot -ChildPath "taskbarchanged.log"
$timestamp = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
$logEntry = "$timestamp - $Message"
Add-Content -Path $logFile -Value $logEntry
}
# Function to set the taskbar location
function Set-TaskbarLocation {
param(
[Parameter(Mandatory)]
[ValidateSet("left", "right", "top", "bottom")]
[string]$Location,
[Switch]$RestartExplorer
)
$bit = 0
switch ($Location) {
"left" { $bit = 0x00 }
"right" { $bit = 0x02 }
"top" { $bit = 0x01 }
"bottom" { $bit = 0x03 }
}
$Settings = (Get-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3 -Name Settings).Settings
$Settings[12] = $bit
Set-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3 -Name Settings -Value $Settings
if ($RestartExplorer) {
Get-Process explorer | Stop-Process
}
# Log the change
Write-Log -Message "Taskbar location changed to '$Location'."
}
# Function to check and update taskbar location
function Ensure-TaskbarLocation {
param(
[Parameter(Mandatory)]
[ValidateSet("left", "right", "top", "bottom")]
[string]$DesiredLocation,
[Switch]$RestartExplorer
)
$CurrentLocation = Get-TaskbarLocation
if ($CurrentLocation -ne $DesiredLocation) {
Write-Output "Taskbar location is currently set to '$CurrentLocation'. Changing to '$DesiredLocation'."
Set-TaskbarLocation -Location $DesiredLocation -RestartExplorer:$RestartExplorer
# Log detailed information about the change
Write-Log -Message "Taskbar location changed from '$CurrentLocation' to '$DesiredLocation'."
} else {
Write-Output "Taskbar location is already set to '$DesiredLocation'. No changes needed."
}
}
Ensure-TaskbarLocation -DesiredLocation "right" -RestartExplorer
' Define the script name
Dim scriptName
scriptName = "move_taskbar_location.ps1"
' Get the current directory of the VBScript
Dim fso, scriptPath, powerShellCommand
Set fso = CreateObject("Scripting.FileSystemObject")
scriptPath = fso.GetParentFolderName(WScript.ScriptFullName)
' Define the full path to the PowerShell script
Dim fullScriptPath
fullScriptPath = scriptPath & "\" & scriptName
' Check if the PowerShell script exists
If fso.FileExists(fullScriptPath) Then
' Build the PowerShell command to run the script
Dim powerShellCommand
powerShellCommand = "powershell.exe -ExecutionPolicy Bypass -File """ & fullScriptPath & """"
' Create WScript.Shell object
Dim objShell
Set objShell = CreateObject("WScript.Shell")
' Run the PowerShell script silently
objShell.Run powerShellCommand, 0, False
Else
' Optionally, log or handle the case where the script is not found
' e.g., Write-Log "PowerShell script not found at: " & fullScriptPath
End If
Save as with name "move_taskbar_location.vbs"Windows 11 sometimes resets the taskbar location or settings after a reboot due to system policies, updates, or changes in configuration. To handle this issue, you can use a few strategies to ensure that your preferred taskbar location is set correctly after each reboot.
- See this link to see how to do it.
- move_taskbar_location.ps1
- or: move_taskbar_location.vbs
- or: create a task in Task Scheduler