locked
Windows 10 Taskbar location RRS feed

  • Question

  • Hello everyone, thanks in advance for any help and advice. I'm trying to use scripting to perform this so using the scripting forum. It may be a Windows 10/Registry question though, apologies if it is more Windows 10/Registry than scripting. 

    I'm trying to move the default location of the Windows 10 Anniversary Update (1607) taskbar from the bottom to the left of the screen.

    [System.Environment]::OSVersion.Version

    Major  Minor  Build  Revision
    -----  -----  -----  --------
    10     0      14393  0       

    I have tried using this URL: Change Taskbar Location to change the location of the taskbar. 
    Code below from here RegKeyCode

    $YourInput = "30,00,00,00,fe,ff,ff,ff,02,02,00,00,00,00,00,00,5d,00,00,00,3c,00,00,00,00,00,00,00,00,00,00,00,5d,00,00,00,b0,04,00,00,90,00,00,00,01,00,00,00"
    $RegPath2  = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3"
    $AttrName  = "Settings"
    
    $hexified = $YourInput.Split(',') | % { "0x$_"}
    New-Item HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3
    Remove-ItemProperty -Path $RegPath2 -Name Settings
    New-ItemProperty -Path $RegPath2 -Name $AttrName -PropertyType Binary -Value ([byte[]]$hexified)

    I have also tried HKLM and also HKU:\.Default\Software\.......
    If I set it this way, each time I log in, it reverts back to the default of 03 for existing and new users.

    If I use the GUI and change it, the above registry key is changed and upon login, the taskbar is moved. 

    Is the GUI setting something somewhere else which then flows into this registry key? I can't seem to find it if it is.

    Thanks again.

    Tim.


    Thanks, Tim. | Please remember to mark the replies as answers if they help. |


    • Edited by Tim Haintz Thursday, January 19, 2017 11:24 PM Version update
    Thursday, January 19, 2017 11:23 PM

Answers

  • When you move the task bar the registry is not updated immediately.  What happens is the desktop is notified of the move (it actually moves the bar based on mouse capture) then the internal code calls a  function that queues the registry update.  Logging of will flush all pending changes. 

    If we directly change the registry the desktop will still flush its settings and, I suspect, may overwrite the changes because other calls that validate the change have not happened when the registry is changed.

    In XP the registry could be changed to move the taskbar using StucRect2.  Vista changed that and Windows 10 has altered more.  I do not think it is possible to move the taskbar with a registry change.

    Some C/C# programmer who builds desktop enhancement tools may know how to do this in code.  I suggest searching for a Windows 10 C# solution.


    \_(ツ)_/

    • Marked as answer by Tim Haintz Friday, January 20, 2017 1:21 AM
    Friday, January 20, 2017 1:18 AM

All replies

  • It is a byte array (Binary)  and not a string.

    D:\scripts> $settings = (Get-ItemProperty  HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3).Settings
    D:\scripts> $settings.GetType()
    
    IsPublic IsSerial Name                                     BaseType
    -------- -------- ----                                     --------
    True     True     Byte[]                                   System.Array
    


    \_(ツ)_/

    Thursday, January 19, 2017 11:42 PM
  • Thanks for the reply JRV.  Is the below converting it into a byte array?

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

    New-ItemProperty -Path $RegPath2 -Name $AttrName -PropertyType Binary -Value ([byte[]]$hexified)

    If I do as you have done above on Settings that I created, I get the below.

    IsPublic IsSerial Name                                     BaseType                                                                                                     
    -------- -------- ----                                     --------                                                                                                     
    True     True     Byte[]                                   System.Array 


    Thanks, Tim. | Please remember to mark the replies as answers if they help. |

    Thursday, January 19, 2017 11:52 PM
  • Like this:

    $hexified = $YourInput.Split(',') | % { [Convert]::ToInt16($_, 16) }


    \_(ツ)_/

    Thursday, January 19, 2017 11:54 PM
  • Ah, I see. Thanks heaps. Testing now. Will let you know how I go.

    Thanks, Tim. | Please remember to mark the replies as answers if they help. |

    Thursday, January 19, 2017 11:55 PM
  • Your array is filled with "0x??" strings.

    Changing the bar location does not update the settings.  There is another registry setting that also controls this but I do not remember what it is.


    \_(ツ)_/

    Thursday, January 19, 2017 11:58 PM
  • Thanks for the reply JRV.  Is the below converting it into a byte array?

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

    New-ItemProperty -Path $RegPath2 -Name $AttrName -PropertyType Binary -Value ([byte[]]$hexified)

    Yes- that works.  I haven't tried that before but thinking of it it will work.

    Start by setting the bar and saving the settings.

    D:\scripts> $settings | Export-CliXml TaskbarSettings.clixml
    D:\scripts> $settings = Import-CliXml TaskbarSettings.clixml
    D:\scripts> $settings[0]

    Now you can dispense with strings.


    \_(ツ)_/

    Friday, January 20, 2017 12:19 AM
  • Thanks jrv, that's a neater solution.

    Disregard last comment. Got confused. Testing now.

    Thanks, Tim.


    Thanks, Tim. | Please remember to mark the replies as answers if they help. |


    • Edited by Tim Haintz Friday, January 20, 2017 1:03 AM Mistake on last update.
    Friday, January 20, 2017 1:01 AM
  • Thanks jrv,

    Tested importing the new $settings into the registry. The reg key updates and looks correct. Log out and log back in, task bar remains the its default location.

    Could it be a bug that the GUI can update the location and the registry but doing it via the registry doesn't work?

    Thanks for all your help.

    Cheers, Tim.


    Thanks, Tim. | Please remember to mark the replies as answers if they help. |

    Friday, January 20, 2017 1:12 AM
  • When you move the task bar the registry is not updated immediately.  What happens is the desktop is notified of the move (it actually moves the bar based on mouse capture) then the internal code calls a  function that queues the registry update.  Logging of will flush all pending changes. 

    If we directly change the registry the desktop will still flush its settings and, I suspect, may overwrite the changes because other calls that validate the change have not happened when the registry is changed.

    In XP the registry could be changed to move the taskbar using StucRect2.  Vista changed that and Windows 10 has altered more.  I do not think it is possible to move the taskbar with a registry change.

    Some C/C# programmer who builds desktop enhancement tools may know how to do this in code.  I suggest searching for a Windows 10 C# solution.


    \_(ツ)_/

    • Marked as answer by Tim Haintz Friday, January 20, 2017 1:21 AM
    Friday, January 20, 2017 1:18 AM
  • Thanks for your help jrv. Will go down that path. Will mark this one as answered as I have more information than I had before and will likely find the solution that way. Will update this with the C# solution when I get it working.
    Thanks again.

    Thanks, Tim. | Please remember to mark the replies as answers if they help. |

    Friday, January 20, 2017 1:21 AM
  • Thanks for your help jrv. Will go down that path. Will mark this one as answered as I have more information than I had before and will likely find the solution that way. Will update this with the C# solution when I get it working.
    Thanks again.

    Thanks, Tim. | Please remember to mark the replies as answers if they help. |

    If one exists.

    Microsoft ahs made a point of preventing developers from altering a users desktop because the rule is the user is king.  No application or script should be able to change a users settings.  Settings that MS allows to be changed are settable through Group Policy.  If this was a setting that could be changed all you would need is to define a GPP that sets the registry.

    MS believes that the desktop is sacrosanct. Only the user should have access except when a company wishes to enforce theme and background restrictions.

    I Windows 7 it was possible to move the taskbar with the registry;  Here is a reg file that does this:

    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2]
    "Settings"=hex:28,00,00,00,ff,ff,ff,ff,02,00,00,00,00,00,00,00,3e,00,00,00,2e,\
      00,00,00,00,00,00,00,00,00,00,00,3e,00,00,00,b0,04,00,00
    
    

    Windows 10 implemented a new key "StuckzRects3" to obfuscate this and apparently has implemented more to prevent direct alteration from code or reg files.

    There ae many, may settings that are proprietary to the Windows user environment.  When a settings is not APIed and documented it always means you should not mess with it. MS will make changes that will break your ideas.

    Believe me.  I have been programming Windows since version .9.  That is the first released version to the developer community which I received at PC Expo way back before anyone knew the name.  It is best to not try to "hack" Windows.  It is fun and a good learning excercise but not good for production environments.


    \_(ツ)_/

    Friday, January 20, 2017 1:36 AM
  • Just looked up this: https://en.wikipedia.org/wiki/Windows_1.0. Assuming 0.9 was a few months before this?
    Thanks jrv.

    Thanks, Tim. | Please remember to mark the replies as answers if they help. |

    Friday, January 20, 2017 2:06 AM
  • It is all a blur but it was probably in May or June.  I think I remember that New York City had good weather.  I used to go to all PC Expos. 

    \_(ツ)_/

    Friday, January 20, 2017 2:10 AM
  • That's very cool. Thanks for the history jrv. 

    Thanks, Tim. | Please remember to mark the replies as answers if they help. |

    Friday, January 20, 2017 2:15 AM
  • Its been a fun, even if bumpy, ride.

    \_(ツ)_/


    • Edited by jrv Friday, January 20, 2017 2:21 AM
    Friday, January 20, 2017 2:20 AM