How to script task bar customizations ?

Discussion in 'Scripting' started by kal, Aug 30, 2017.

  1. kal

    kal MDL Junior Member

    Aug 18, 2007
    94
    17
    0
    Hi !

    I'm trying to figure out a way to customize the Task Bar during SetupComplete.cmd. For instance, I would like to remove the Edge icon and add the Chrome icon.

    I have no idea how to do it as it seems that lnk file aren't enough :sticktongue:

    Thanks :giverose:
     
  2. Thucydides

    Thucydides MDL Novice

    Apr 10, 2015
    5
    0
    0
    #2 Thucydides, Sep 22, 2017
    Last edited: Sep 22, 2017
    Hello:

    Here is what I know:

    Microsoft, over time, has come to the conclusion that only USER INTERACTION should modify the task bar. Whether or not that makes any sense to everyone else is of little concern for them. The shell team, or whoever it is thats in charge of writing the code for that part of windows, has made it a point to make it practically impossible to set up the task bar via automation, scripts, or whatever. Now, this does not mean it cannot be done. However, as I make a living programming, I will tell you outright that what you want to may not be worth your time. There are so many programming interfaces for windows, and a good many are basically unknown to us, as Microsoft purposefully refrains from providing documentation and especially support if you indeed find out that you can use one of them. The programmer in me looks at the great lengths with which Microsoft tries to conceal this function of the OS and says, "OK, fine, I get it, you don't want me using it." But the fact of the matter is that you can. The learning curve might be too steep for you, or it may not. Until the community is graced with the benevolence of someone who has found a reasonable workaround for automating task bar customization, we are kind of S.O.L.

    ***disclaimer***
    you will have to replace the X in the links i provide with an S. There is an arbitrary cap of 5 posts, which once you achieve that number, you are allowed to paste links. Lol. I sadly do not have that many yet.
    ***disclaimer***

    There is the way described here: httpX://docs.microsoft.com/en-us/windows-hardware/customize/desktop/customize-the-taskbar. But it only allows 3 shortcuts, which in my opinion is absurd. 3 is an arbitrary number and could easily have been infinity had a programmer simply withheld writing a constraint that stopped at 3. Why stop at 3. I hear 4.5 is better...or even -2.8. You see where I am going with that...

    I used this api years ago: httpX:msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx. It served me well, but nowhere in the api does if follow logic in the modern sense of the word. You may have to make a box with windows 7 and see if you can get the customizations you want, then move boldy to the next os, tweaking your program so that the newer windows makes it functional. Its not going to be very fun, but It can be if you have patience.

    I hope that helps. And of course, if you find a simple, more elegant solution, let me know. Take care!
     
  3. GodHand

    GodHand MDL Senior Member

    Jul 15, 2016
    270
    217
    10
    You can add many more than 3 shortcuts...

    Do a fresh install of Windows 10 on a VM, set up the taskbar and Start Screen as you like, then Export-StartLayout with PowerShell. You can incorporate both a new Start Menu layout and Taskbar configuration in one .XML

    If you make one without running a fresh install to Export the layout, just make sure you have the proper AUMIDs entered.

    Here's a quick function that will help. Just paste it in an elevated PowerShell console to pipe the function, then just type "Listaumids" and you will see all of the ones installed on your PC.

    Code:
    function listAumids( $userAccount ) {
    
        if ($userAccount -eq "allusers")
        {
            $installedapps = Get-AppxPackage -allusers
        }
        elseif ($userAccount)
        {
            $installedapps = get-AppxPackage -user $userAccount
        }
        else
        {
            $installedapps = get-AppxPackage
        }
        $aumidList = @()
        foreach ($app in $installedapps)
        {
            foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id)
            {
                $aumidList += $app.packagefamilyname + "!" + $id
            }
        }
        return $aumidList
    }