*UPDATE 2024-07-07*
New revised version please see new post
- Fixed: Reported issue in v2 where Success key was placed in HKLM\Software\WOW6432Node\*name*\Taskbar instead of HKLM\Software\*name*\Taskbar.
Thanks Ronny. - Some users are reporting issues with Icons being blank, please make sure the application is installed and the .lnk file is in the %AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
If you are still having issues please test if rebuilding IconCache works and please report it to me.
Added a second version with a couple of changes. This version will run for all users who logs into the device setting the Taskbar once, then allowing the user to configure the taskbar themself. This uses a Scheduled-Task that checks if the Taskbar have been applied to the user profile during login. I have set this to call VBS script to make sure the process runs hidden. (This is similar to a logon script) It uses the RunOnce key for the first deployment and then the Scheduled-Task for all other users that logs on to the device.
Go to version deployed for all users at login.
*UPDATED 2023-08-16*
Updated script to also copy AppData file to resolve issue where icon might turn blank.
Changed to only import Favorites key, no other keys needed in the .reg file.
Added logging function, writes a log file to Windows\temp folder.
I have seen a lot of posts regarding this, you want to deploy a standard taskbar from the start but then allow the user to pin their own apps.
Using Intune, you can set an XML file with a customized taskbar, however this will not allow the user to pin their own apps, or it will revert back on each sync.
Microsoft documentation for creating a taskbar policy in Intune.
The old way with Windows 10 we could simply import the XML file, we could also use PowerShell to modify the taskbar. From Windows 10 21H2 you can no longer modify the taskbar using PowerShell. (Well, you can remove all the icons but not add icons back in a good way 😊)
With this post, I will go over how you can deploy your customized taskbar in Intune and still allow the user to pin their own apps afterward.
Preparing your Taskbar
How to pin apps to your desktop
- Spin up a new VM or use a device with all the apps that you want to pin already installed.
- Create your perfect taskbar on your new machine.
(If you have custom apps make sure they are installed in the same directory and during the deployment of the PC)
Exporting the registry keys for the Taskbar.
- Open the Registry Editor
- Go to: HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband
The registry keys for the taskbar contains all the pinned apps. You can get this from two places, to make this easier we will use the HKEY_CURRENT_USER however the value is also available in HKEY_USERS under the SID for your current user.
When you pin and unpin apps to the taskbar you will see these values changes.
- Right click on the folder “Taskband” and select Export.
- Save the file to your preferred location and name it TaskBar.reg
Modifying the .Reg file (TaskBar.reg)
- Open the exported .reg file (TaskBar.reg) with your favorite text editor (Notepad)
Modify the following parts only.
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband]
Change to:
[HKEY_USERS\UserSID\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband]
Remove everything except the “Favorites” key
Example of how completed reg should look like below.
Windows Registry Editor Version 5.00
[HKEY_USERS\UserSID\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband]
"Favorites"=hex:00,50,01,00,00,3a,00,1f,80,c8,27,34,1f,10,5c,10,42,aa,03,2e,e4,\
52,87,d6,68,26,00,01,00,26,00,ef,be,12,00,00,00,d2,65,e6,c8,da,bb,d9,01,e8,\
b0,3d,f0,da,bb,d9,01,80,35,b2,df,c3,c7,d9,01,14,00,56,00,31,00,00,00,00,00,\
05,57,c6,8c,11,00,54,61,73,6b,42,61,72,00,40,00,09,00,04,00,ef,be,f5,56,e0,\
6e,05,57,c6,8c,2e,00,00,00,12,a4,01,00,00,00,01,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,56,9c,6a,00,54,00,61,00,73,00,6b,00,42,00,61,00,72,00,00,\
00,16,00,be,00,32,00,c7,08,00,00,05,57,fc,8c,20,00,47,4f,4f,47,4c,45,7e,31,\
2e,4c,4e,4b,00,00,54,00,09,00,04,00,ef,be,05,57,04,8d,05,57,04,8d,2e,00,00,\
00,0a,02,00,00,00,00,03,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,f3,71,\
01,01,47,00,6f,00,6f,00,67,00,6c,00,65,00,20,00,43,00,68,00,72,00,6f,00,6d,\
00,65,00,2e,00,6c,00,6e,00,6b,00,00,00,1c,00,22,00,00,00,1e,00,ef,be,02,00,\
55,00,73,00,65,00,72,00,50,00,69,00,6e,00,6e,00,65,00,64,00,00,00,1c,00,12,\
00,00,00,2b,00,ef,be,80,35,b2,df,c3,c7,d9,01,1c,00,1a,00,00,00,1d,00,ef,be,\
02,00,43,00,68,00,72,00,6f,00,6d,00,65,00,00,00,1c,00,00,00,ff
Now your .Reg file is ready, this can be imported to any Windows 11 device 😁
(Not tested on Windows 10)
User Pinned .lnk files in AppData folder.
This part is only required if you have installed other 3rd party application and pinned them to the taskbar. We need these files to make sure the taskbar icons do not end up without a working icon. (If you skip this part, modify the script and remove the part for copy files from AppData folder)
On your device that you used for preparing the taskbar go to the folder.
%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
You should see Icons from third party applications here. We need to copy them and place them in our script folder. Create a folder named AppData in the same folder where you will place the script and your .reg file.
PowerShell Script to deploy import the .Reg file during Autopilot Deployment.
We want to have this applied before the user logs in, so we will deploy this as a Required Win32 app in Intune during deployment.
The script will loop through all users (Excluding some built in user SID’s) It will then modify the “UserSID” in the reg file to match each user SID and create a temporary .reg file and import it and then delete the temporary reg file.
(Remember when we edited the .Reg file we change it to this HKEY_USERS\UserSID\ This part is being modify by the script and setting the SID’s)
The function named Copy-TaskbarFilesToAllUsers will copy the files you place in the AppData folder, and place them in the user profile during deployment.
The Script will then create a registration key depending on if it failed or succeeded using the CleanUpAndExit function.
(This function is something I tend to re-use a lot and was created by Peter Klapwijk: https://www.inthecloud247.com/)
You need to modify this part to place the registry value of the success or failed in the location where you want it.
$StoreResults = “\Contoso\TaskBar”
This will be used to verify if the application was successfully installed later.
Download Script Import-Taskbar.ps1
<#
.SYNOPSIS
This script imports a configured taskbar and copies any required .lnk files to the AppData folder.
.DESCRIPTION
The script works by performing the following steps:
1. Imports shortcut files for new taskbar.
2. Imports registry values for taskbar icons.
3. Checks if any error occurred and writes results to registry.
4. Log created in Windows\temp
#>
# If running in a 64-bit process, relaunch as 32-bit
If ($ENV:PROCESSOR_ARCHITEW6432 -eq "AMD64") {
Try {
&"$ENV:WINDIR\SysNative\WindowsPowershell\v1.0\PowerShell.exe" -File $PSCOMMANDPATH
}
Catch {
Throw "Failed to start $PSCOMMANDPATH"
}
Exit
}
# CleanUpAndExit
Function CleanUpAndExit() {
Param(
[Parameter()][int]$ErrorLevel = 0
)
# Write results to registry for Intune Detection
$StoreResults = "\Contoso\Taskbar" # Change this to something that fits you.
$Key = "HKEY_LOCAL_MACHINE\Software$StoreResults"
$NOW = Get-Date -Format "yyyyMMdd-HHmmss"
If ($ErrorLevel -eq 0) {
[Microsoft.Win32.Registry]::SetValue($Key, "Success", $NOW)
} else {
[Microsoft.Win32.Registry]::SetValue($Key, "Failure", $NOW)
[Microsoft.Win32.Registry]::SetValue($Key, "Error Code", $Errorlevel)
}
# Exit Script with the specified ErrorLevel
EXIT $ErrorLevel
}
# Log File Info
$Now = Get-Date -Format "yyyyMMdd-HHmmss"
$LogPath = "$ENV:WINDIR\Temp\ImportTaskbar_$Now.log"
# Function to write log entries
function Write-LogEntry {
param(
[string]$Message
)
Write-Output "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - $Message" | Out-File -FilePath $LogPath -Append
}
# Write to log file
Write-LogEntry "Start Setting Taskbar"
# Copy-TaskbarFilesToAllUsers
function Copy-TaskbarFilesToAllUsers {
param(
[string]$sourceDir = "$PSScriptRoot\AppData"
)
Write-LogEntry "Copying taskbar files for all users..."
$Success = $true
$userSIDs = Get-WmiObject -Class Win32_UserProfile | Where-Object { $_.Special -eq $false } | ForEach-Object { $_.SID }
foreach ($userSID in $userSIDs) {
$userProfilePath = (New-Object System.Management.ManagementObject "Win32_UserProfile.SID='$userSID'").LocalPath
try {
# Define target directory for the current user
$targetDir = "$userProfilePath\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
# Ensure the target directory exists
if (!(Test-Path -Path $targetDir)) {
New-Item -ItemType Directory -Force -Path $targetDir
}
# Copy files from source to target
Copy-Item -Path "$sourceDir\*" -Destination $targetDir -Recurse -Force
Write-LogEntry "Files copied successfully for user $userSID."
}
catch {
$ErrorMessage = "An error occurred while copying files for user ${userSID}: $($_.Exception.Message)"
Write-LogEntry $ErrorMessage
Write-Host $ErrorMessage -ForegroundColor Red
$Success = $false
}
}
if ($Success) {
Write-LogEntry "Files are copied successfully for all users."
}
return $Success
}
# Import-RegFileToAllUsers
function Import-RegFileToAllUsers {
Write-LogEntry "Importing registry values for all users..."
$Success = $false
$originalRegFileContent = Get-Content -Path "$PSScriptRoot\Taskbar.reg"
foreach ($userPath in (Get-ChildItem "Registry::HKEY_USERS\" | Where-Object { $_.Name -notmatch '_Classes|S-1-5-18|S-1-5-19|S-1-5-20|\.Default' })) {
$username = $userPath.PSChildName
try {
# Replace the specific user SID with the SID of the current user in the loop
$modifiedRegFileContent = $originalRegFileContent -replace 'UserSID', $username
# Write the modified content to a temporary .reg file
$tempRegFilePath = Join-Path -Path $PSScriptRoot -ChildPath "TempTaskBar.reg"
$modifiedRegFileContent | Out-File -FilePath $tempRegFilePath
# Import the temporary .reg file
Start-Process -FilePath "regedit.exe" -ArgumentList "/s `"$tempRegFilePath`"" -NoNewWindow -Wait
# Delete the temporary .reg file
Remove-Item -Path $tempRegFilePath -Force
$Success = $true
Write-LogEntry "Registry values imported successfully for user $username."
}
catch {
$ErrorMessage = "An error occurred while importing registry values for user ${username}: $($_.Exception.Message)"
Write-LogEntry $ErrorMessage
Write-Host $ErrorMessage -ForegroundColor Red
$Success = $false
return $Success
}
}
if ($Success) {
Write-Host "Registry values are set correctly for all users."
}
return $Success
}
# Call the Copy-TaskbarFilesToAllUsers function
$importAppDataResult = Copy-TaskbarFilesToAllUsers
# Call the Import-RegFileToAllUsers function
$importRegFileResult = Import-RegFileToAllUsers
# If all functions ran successfully, exit with error code 0, else use error code 101
if ($importAppDataResult -and $importRegFileResult) {
Write-LogEntry "All functions completed successfully. Cleaning up and exiting..."
CleanUpAndExit -ErrorLevel 0
} else {
Write-LogEntry "One or more functions encountered errors. Cleaning up and exiting..."
CleanUpAndExit -ErrorLevel 101
}
Write-LogEntry "Script execution completed."
$LogPath = $null
Packaging the files as a Win32 application
We will use the Microsoft Win32 Content Prep Tool to package the files.
- Create a new folder where you place the script from above (Import-TaskBar.ps1) with the .Reg file you edited before (TaskBar.reg)
- Create a new folder in the root named AppData this contains all your .lnk files.
- Start the Microsoft Win32 Content Prep Tool as Administrator.
- Select the location where stored your files.
- Specify the setup file: Import-TaskBar.ps1
- Select the folder where you want the output.
- The file .intunewin will contain all the files you had in the folder.
- A file named Import-TaskBar.intunewin should now have been created.
Deploy the package using Intune
Go to Intune and select Apps, Add a new Win32-based app.
- Add the package that we just created Import-TaskBar.intunewin
- Add a name, description, Publisher, Version etc.
Program settings
Install command: powershell -executionpolicy bypass -file Import-TaskBar.ps1
Install behavior: System
Requirements
Detection rules
Here we will check after the Success or Failed reg key created by the CleanupAndExit function, if fails the key Success will not be available.
Rule format: Manually configure detection rules.
Rule type: Registry
Key path: HKLM\Software\Contoso\Taskbar
Value name: Success
Detection method: Value exists.
Assign the newly created app to your User or Device group as Required.
(This will overwrite any current user settings they have, so you can assign it to only new users/devices if you like, it only overwrites it once the user can then pin or remove apps in the Taskbar themself)
You are done, now when a new device is deployed the user will have your perfect Taskbar from start and they can later pin or unpin apps to the taskbar however they like.
Worth mentioning, this is not an official way, however as of today 2023-07-21 this works and most likely it will continue to work unless Microsoft makes some major changes again like they did with the Start-Menu.
Below section is only applicable to version deployed for all users.
Version “Run for all logged in users”
Please make sure you follow the steps above as this is the same, the only difference is the script itself.
Difference between the scripts.
This version handles things a bit differently, this is to accommodate for the request to have a version to run not only for the first deployed user but for all users that log on to the device after the deployment.
The VBS script used is only to make sure it runs hidden, this means no PowerShell window showing up etc.
- Uses RunOnce key for the first deployed user to call a VBS script. (The VBS script then runs the PowerShell script hidden.
- Introduced a registry key to check if the user have already been applied the Taskbar, this makes sure the Taskbar settings is not overwritten when the user makes changes.
- Creates a Schedule-Task to call the same script the RunOnce key does, it will run at every logon, it checks if the Taskbar have been applied to the user, if not it will apply it once.
- To achieve that the new Taskbar is instantly applied I had to restart Explorer, added function for this.
- Not required to modify Registry file during deployment.
Instead of rewriting everything I will link to the steps that are the same and add the changes below only.
Download the new version.
The zip file contains the following
Import-Taskbar.ps1
Set-Taskbar.ps1
RunHidden.vbs
Setup Guide
- Preparing your taskbar
- Exporting the registry keys for the Taskbar
- Edit exported registry file
- User Pinned .lnk files in AppData folder
- Packaging the files as a Win32 application
- Deploy the package using Intune
Edit your exported Taskbar registry file
- Open the exported .reg file (TaskBar.reg) with your favorite text editor (Notepad)
- Remove everything except the “Favorites” key and save it.
- Example of completed registry file
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband]
"Favorites"=hex:00,50,01,00,00,3a,00,1f,80,c8,27,34,1f,10,5c,10,42,aa,03,2e,e4,\
52,87,d6,68,26,00,01,00,26,00,ef,be,12,00,00,00,d2,65,e6,c8,da,bb,d9,01,e8,\
b0,3d,f0,da,bb,d9,01,80,35,b2,df,c3,c7,d9,01,14,00,56,00,31,00,00,00,00,00,\
05,57,c6,8c,11,00,54,61,73,6b,42,61,72,00,40,00,09,00,04,00,ef,be,f5,56,e0,\
6e,05,57,c6,8c,2e,00,00,00,12,a4,01,00,00,00,01,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,56,9c,6a,00,54,00,61,00,73,00,6b,00,42,00,61,00,72,00,00,\
00,16,00,be,00,32,00,c7,08,00,00,05,57,fc,8c,20,00,47,4f,4f,47,4c,45,7e,31,\
2e,4c,4e,4b,00,00,54,00,09,00,04,00,ef,be,05,57,04,8d,05,57,04,8d,2e,00,00,\
00,0a,02,00,00,00,00,03,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,f3,71,\
01,01,47,00,6f,00,6f,00,67,00,6c,00,65,00,20,00,43,00,68,00,72,00,6f,00,6d,\
00,65,00,2e,00,6c,00,6e,00,6b,00,00,00,1c,00,22,00,00,00,1e,00,ef,be,02,00,\
55,00,73,00,65,00,72,00,50,00,69,00,6e,00,6e,00,65,00,64,00,00,00,1c,00,12,\
00,00,00,2b,00,ef,be,80,35,b2,df,c3,c7,d9,01,1c,00,1a,00,00,00,1d,00,ef,be,\
02,00,43,00,68,00,72,00,6f,00,6d,00,65,00,00,00,1c,00,00,00,ff
Packaging the files as a Win32 application (New)
We will use the Microsoft Win32 Content Prep Tool to package the files.
- Create a new folder where you place the script files from the Download section (Import-Taskbar.ps1, RunHidden.vbs, Set-Taskbar.ps1) and your Taskbar.reg file.
- Create a new folder in the root named AppData this contains all your .lnk files.
- Start the Microsoft Win32 Content Prep Tool as Administrator.
- Select the location where stored your files.
- Specify the setup file: Import-TaskBar.ps1
- Select the folder where you want the output.
- The file .intunewin will contain all the files you had in the folder.
- A file named Import-TaskBar.intunewin should now have been created.
I’ve had issues with shortcuts for Chrome, for example, breaking after an update and the script (or rather the reg export) being redundant within days.
The shortcut is then just a broken white page.
Any ideas how to get around this one?
I will try out your senario this week, have old versoin of Chrome installed. Move reg to new device update Chrome. I will also update the post, there seem to be some issues when removing Edge etc, but clearing pinned apps seems to solve it. Thank for the update, hoppfully I have something this weekend
Nathan i will update the post, tomorrow. I did not try to replicate your issue however instead of only importing a reg file i will also import lnk files from quick launch. And I will only import one reg value instead, before doing this I clear all the values.
I tested this with having Chrome v114 pinned, and move over to a new device, then update chrome, restart etc icon stays and Chrome is working. Thank you for the feedback I rushed my first post and only tested on built in apps.
May I ask if you are having trouble with Edge icon not being removed from taskbar? I have solved your issue but ran into a new one for Edge removal from taskbar
Oddly not, Edge has been removed just fine in our tests so far. I will double check tomorrow.
Confirming Edge is being removed OK for us. We are using Win 11 Pro/Business only if this helps in troubleshooting.
Thank you, I will update the post. I think I will have to add a function for Edge issue, but you dont need to turn on this part. For your issue I added a new function, you will have to add the Quick Links for 3rd party apps like Chrome into the package. But I will update the post this week.
I have updated the script to handle your issue. I tested this with old version of chrome and then let the device update chrome and icon looks perfect in the taskbar, sorry for the delay.
I have a second script that im testing, this would run one time when user signs in and set everthing, it also handles the issue with Edge and File explorer removal. But the updated script now solves your issue
Hi is this script available please? This has been a life saver.
I have followed the instructions. Do the users have to be signed in first for this script to work? Will it work when a new user signs into the PC as this doesn’t seem to be happening? If I run the script manually it works when the user is signed in but not for other users that had signed into the PC. What am I doing wrong? We are not using autopilot but deploying with intune. Log file says success.
This script will only run once during deployment. So it will only be available to the first user.
If you set the application to required install on user it will install when the user signs in, however I have not included a restart of explorer.exe this is required to show the new taskbar instantly. I have another version of this script that uses Run key in register, if you set the runkey on local machine it will always run for all users instantly when they login. I will update the post during this week or early next week with the new script and I will include a small section describing how you can use the Run key on local machine to basically run a logon script, but this runs everytime the user logs in, the script can then check if the taskbar have been set already for the user and then it would terminate itself.
First just want to say that your work here is incredible and much appreciated! Crazy that Microsoft doesn’t officially offer a method to do this.
My current issue is that during Autopilot Enrollment that my RMM Agent gets installed and quickly after it will create a new user (a Local Admin, by design), and so the Taskbar will usually get applied to that user instead of the actual Enrolled user (verified by the Script Log). It just depends on the order of how Required Apps are installed at Enrollment it seems.
Though, it sounds like your Run Key edits you mentioned in the comment above should fix that issue – along with the fact a restart of Explorer.exe is required. Eagerly awaiting to see what you come up with.
Thank you for letting me know this issue, i will publish the other version this weekend. As it should fix your issue, applied to all users. Have not had the time to test it fully so hopefully this weekend
Hello There
Is the script already updated?
I have the same issue. Our new users that are receiving the notebooks are not the first logged in user, because our IT Department hands over the notebook to the new user. But those New users are Azure AD Connected and not local users. Will your script also include an initial taskbar rollout for users that have not logged in yet?
Great work so far, your tutorial works as a charm 🙂
My script currently runs during deployment. It looks for all user profiles and applies it during that stage.
The other script is only half tested and deploys a schedule task and uses the registey to create a key in Run. I need to test this for certain senarios.
I will try to get it done this week but in certain senarios a login script might be the only way where it checks if it have already been applied or not, but the down side is that it runs on every startup.
Please test your senario with the current code and check the log files what it says.
New way available
https://www.everything365.online/2024/07/07/deploy-a-customized-windows-11-taskbar-that-allows-users-to-change-the-pinned-apps-revised-version/
Will update this post this week.
Just finished the script, but need to test it.
This will run for all users, even when a new user logs on it will set the taskbar once for every user. It will use a schedule task that checks if the taskbar have been applied before.
when I deploy the script then it is only applied to the first logged in user.
Second problem is, when I add MS Teams to the taskbar, the shortcut symbol appears blank. (See Picture) I am also not able to reopen this shortcut again. When i close teams and click the icon the following Message appeared:
”Can’t open this item
It might have been moved, renamed, or deleted. Do you want
to remove this item?”
The shortcut contains:
Target: C:\Users\%username%\AppData\Local\Microsoft\Teams\Update.exe –processStart ”Teams.exe”
Starts in: C:\Users\%username%\AppData\Local\Microsoft\Teams
The current script is only applied for the first user.
I will have 2nd version this week it will deploy to all users all the time.
For your Teams issue make sure you include the Teams lnk file in the AppData folder in the script, you need to copy all lnk files
I have now updated a new version of the script, this will apply to all users that login to the device.
If you created links for 3rd party applications you must copy the files from the AppData folder and make sure the applications are installed. This will fix your issue with icons going blank.
You can try to add your local admin account to the exclusion when it loops thrue accounts, not sure this will help.
Yes, I was actually going to try that but haven’t gotten around to it just yet! Will have to let you know when i do – hopefully by mid-next week.
Hi Jamie a new script is available, this resolves your requirement and runs fof all users that logs in.
New way available
https://www.everything365.online/2024/07/07/deploy-a-customized-windows-11-taskbar-that-allows-users-to-change-the-pinned-apps-revised-version/
Hi,
Thank you for creating and sharing this wonderful script!
I used the second version and tested it on Windows 10. The task bar was set correctly but I received the following error in Intune: ”The application was not detected after installation completed successfully (0x87D1041C)”
After some troubleshooting, I noticed that the HKLM key was not present in
HKLM\Software\*name*\Taskbar
but I was able to locate it under
HKLM\Software\WOW6432Node\*name*\Taskbar
To fix this, we need to force the app to run in a 64-bit context. You can do so by changing the install command in Intune from
powershell -executionpolicy bypass -file Import-TaskBar.ps1
to
%windir%\sysnative\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -file Import-TaskBar.ps1
Best regards and keep up the good work!
I will look at this during the weekend, i usally add a code for it, or if set to install as 64bit.
Thank you for letting me know
See I missed this part in version 2.
From version 1 i check this in the script.
# If running in a 64-bit process, relaunch as 32-bit
If
(
$ENV:PROCESSOR_ARCHITEW6432
-eq
"AMD64"
) {
Try {
&
"$ENV:WINDIR\SysNative\WindowsPowershell\v1.0\PowerShell.exe"
-File
$PSCOMMANDPATH
}
Catch {
Throw
"Failed to start $PSCOMMANDPATH"
}
Exit
}
Glad to have found something that tries to make this work! Hard to believe how many hoops we have to jump through in Windows 11.
My question to you; I have currently deployed the app as instructed with shortcut .lnks in an AppData folder. They all apply to the taskbar as expected however they appear as blank icons. When clicked they give the error ”Can’t find this item. It may have been moved, renamed, or deleted”. However when I check the properties of the shortcut it does properly link to the .exe file.
Is there any way to resolve this? The files I have this issue with are Edge, Word, Excel, OneNote, Outlook.
I will try to look into this, the apps are installed on the device?
Will test it out with all office apps and Edge during the weekend
Thanks for responding. Yes the apps are installed as part of a task sequence/image. Even more strange is that if I go to the actual applications and right click them to add them to the taskbar, the option given is ”Unpin from taskbar”. So as far as Windows can tell they are actually pinned… I’ll continue to tinker with this in hopes I can find a fix and will update this thread if I do – but I appreciate you looking into it!
I will try to see of I can generate the same issue and please let me know if you find something
Can you try clearing the icon cache.
C Drive > Users > %Your in-use account% > AppData > Local.
Find the IconCache file with a DataBase File type and delete it.
So maybe I’m just underthinking this, but I think there’s an easier way to apply the taskbar changes to all users.
Could you not import the registry / appdata files into the defaultuser profile? Change
[HKEY_USERS\UserSID\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband]
to
[HKEY_USERS\Default_User\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband]
Then to import, you’d simply do:
%windir%\sysnative\reg.exe load HKU\Default_User C:\users\default\ntuser.dat
%windir%\sysnative\reg.exe import C:\Path\To\Taskband.reg
This is bound to be affected by the same SysNative Gotcha in deployments as mentioned in your other comments, so you’ll likely wanna call the SysNative version of reg.exe
Copying the user-pinned taskbar icons should be easy, as well; just place them in
C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
This way, every new user that logs gets the customized taskbar.
For those using SCCM / MDT / some other EPM suite, you’d want to do this after you lay down your WIM and before your first boot.
I think i tested using Defaultuser but did not get the results i wanted, but i will check this way you describe, it sound logical and a simple approach so I will test this out. For sysnative I usally add the If running in 64 bist part, this is in version one but i missed it in version 2
I remember now, defaultuser does not work during the deployment without a restart. But i will test again.
And thank you for the input
Does this still work. I tried to apply the exported and edited registry key to another machine and restarted explorer but nothing changed?
Yes this currently works
I’m having issues with this as it runs once immediately after Autopilot enrollment – and it looks perfect. But then after a normal device reboot all of the previously pinned icons as part of the script disappear as if it never actually ran. Any idea what is overwriting the previous taskbar layout?
Log file is showing no errors (scheduled task apparently created?). Registry shows correct run date. Using the ”Run for all logged in users” version.
Are you running version 1 or 2 of the script?
If you manually trigger the schedule task again, does the icons come back?
Do you have any policies setting the taskbar?
Version 2.
No, they don’t. And no policies setting the taskbar. Strangely enough, now the disappearance of the customized taskbar seems to be at a random reboot – not on first reboot. I think the issue actually has more to do with an error that I’m encountering that only appeared after starting to test this custom config, which I only see when the computer shuts down – I get a ”powershell.exe – Application Error. The application was unable to start correctly (0x0000142). Click OK to close the application”. Logs in windows\temp are showing all successes.
Will try to replicate this during the weekend if I have time. Maybe the script checking if the taskbar have been applied fails to start for some reason resulting in a blank taskbar.
Can you try to run it once then delete the schedule task and see if you run into the issue, it will then only run once and never again but i would have more info on why this is happening to you.
I’m running the v2 (all users) script and confirmed it works when I run the scheduled task manually. For some reason, it does not appear to trigger for me when I login the first time. I’m wondering if this is because I got prompted to enroll in Windows Hello for Business first thing when my users login and that’s messing with the scheduled task/explorer reset. Have you experienced this? (Running in a HyperV VM btw)
Could you try running v1 and see if that works for your first enrollment.
Will look over this sunday, have not had the time sorry.
Hey there,
Thanks for your work on this.
I notice on version 2 of the script if I run it manually it seems to fail on the set-itemproperty for the variable $userregistrypath as it has not been initialized.
Will try to look at this soon, have had very little time available.
Hi, I can confirm on V2 the variable $userRegistryPath was not initialized.
Hey I found the issue why people are most likely seeing the blank icons. What I found that is when it tries to copy the .lnk files to the users appdata folder. It fails because it’s trying to copy the hidden desktop.ini file which it doesn’t like and throws a permission error. Easy fix is to change the copy-item to .lnk files only like this:
Copy-Item -Path “$sourceDir\*.lnk” -Destination $targetDir -Recurse -Force
Hope this helps also great script!
Best,
Austen
Thats great info Austen, will update the script and this post as soon as i have some time off, i will make sure to test this out
Hello there
First of all great approach, i honestly cannot believe we have to jump trough those kind of hoops in order to allow the user to add/remove their own icons.
I have to submit an issue,
im currently using the version of the script which sets the taskbar for the SID whos using it.
The script works fine and as it should but after few reboots or I suspect after some windows updates Taskbar ends up emtpy.
All the Icons that have been in ”%appdata%…..\Taskbar” are removed and the regkey also changes its value compared to the ”Taskbar.reg”
Only one user account has been used on the machines that this happens.
Id greatly appreciate any solutions for this problems!
Will see if i can re create this.
MS should be releasing a option to allow us to set the taskbar once, i dont recall where i saw this but hopefully in 24H2 release.
But I will take a look at this, currently i have very little free time but I will get back to this post soon and test everything from all the comments and see what I can replicate and fix
Thank you for the great effort you’ve put in.
I’ve been testing this script outside of Intune (using the Fog Project as a snapin). It works great for the first user that logs on, but for the rest of the users it hangs on the first login while the message on the screen says something like ”We’re still working on a few things”. It stays like this for a very long time. I can force the computer off and then it seems to apply the settings.
Any idea why this happens?
Hi Rune, sorry I have not had any free time to look into this at all, will try my best to rebuild this into something more stable
Resolve the issues now and simlified everything, this is now one file works for all users and single user. Will create a new post for it this week. Just need to test more scenarios
New way available
https://www.everything365.online/2024/07/07/deploy-a-customized-windows-11-taskbar-that-allows-users-to-change-the-pinned-apps-revised-version/
This should work much better