I'm trying to use Invoke-HKCURegistrySettingsForAllUsers to remove the start tiles for existing users on a machine. The code I'm using is:
[scriptblock]$HKCURegistrySettings = {
Remove-RegistryKey -Key 'HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\*$start.tilegrid$windows.data.curatedtilecollection.tilecollection' -Recurse -SID $UserProfile.SID
}
Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings
Get-Process Explorer | Stop-Process
It works for the currently logged in user but not for any others. I believe it is failing because there is a wildcard in the path.
What would be a better way of getting any key in the path ‘HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\ that contains $start.tilegrid$windows.data.curatedtilecollection.tilecollection’?
The actual key in that path is de{4ed38a68-bb27-402c-9ffd-d7eece54272c}$start.tilegrid$windows.data.curatedtilecollection.tilecollection but the beginning part changes from user to user.
I just looked up active-setup and that won’t work for me. Unfortunately, about 800 machines were imaged with the wrong taskbar and start tiles. I have fixed the image for new deployments. I want to modify the task bar and start tiles for existing profiles on these 800 machines. My script does the following:
Removes Edge from each desktop
Disables any new profiles from putting the Edge icon on the desktop
Copies a new layoutmodification.xml to each user’s profile
Imports a new custom layout for new users.
The part I’m having problems with is consistently getting it to open the registry hive for each user and get rid of the old start tiles.
Actually a very valid question as i’m in the same case and i wouldn’t be surprised many others - the Remove-RegistryKey does convert the values (Convert-RegistryPath) and also seems to rely on remove-item built-in powershell cmdlet… but with the ‘LiteralPath’ - so you wouldn’t be able to use wildcards/variables in the key…
the problem is also that the GUID preceding those keys is different for every user.…
It’s a pity because again i’m sure everyone needs to reset those Tiles/StartLayout for every user now and then and it was the Microsoft’s consultant recommendation to do it this way…
I tried bypassing the function by just using Get-UserProfiles and using the built-in Remove-Item which DOES support wildcards… BUT than again you don’t have the power of the Toolkit to enumerate though all user profiles and loading any ntuser.dat where necessary
you see it’s partly removed - trying to escape the charcaters doesn’t work
what i’m working on is getting to load the profils/ntuser.dat and removing the key with Remove-Item is it accepts wildcards and character escape (as in my screenshot above)