Cortana/Windows Search breaks in default profile
-
@Arrowhead-IT No, Cortana and the Start Menu are both working fine in the source account, but once copied to the default profile Cortana and the Start Menu do not work for any new accounts. I tried creating the profile from a local user account as well as from a domain user account and it did not make a difference. I have my image in a VM so I can use a snapshot to quickly “unbreak” the default profile if you have any thoughts on things to try.
-
To my knowledge, you can’t just copy profiles from one account to another as it causes issue.
I think the better path to walk is to manipulate the registry entries for the default user profile and save those keys in a reg file to be applied at any time (or alternatively simply collect the registry manipulation in a batch file, same result really).
I use a combination of registry manipualtion and regular file adding/removing to customize the default user. It’s not perfect, but it doesn’t cause issues and has saved us a lot of time.
This part copies the theme from our local NAS and then manipulates the registry entries for default users so it becomes the default theme for any new user.
copy /y "\\path\to\theme\theme.themepack" %SYSTEMROOT%\Resources\Themes\ cmd /c reg load HKU\TempHive "%SystemDrive%\Users\Default\NTUSER.DAT" cmd /c reg add HKU\TempHive\Software\Microsoft\Windows\CurrentVersion\Themes /v CurrentTheme /t REG_SZ /d "%SYSTEMROOT%\Resources\Themes\theme.themepack" /f cmd /c reg unload HKU\TempHive
-
@csuther3 That is odd, I haven’t had that issue, and I’ve made profiles with this with local and domain accounts successfully, I think doing it from a local account is a better practice though. I also make them from a VM.
Maybe there’s an indication in the log files. There shouldn’t be any sensitive information in the log so post away.
When you create a profile the logs go in a logs folder in that profiles share folder. i.e \profilesShare\Win10\ProfileName\logs
Then when the profile is applied a log is created on the root of the C drive on the computer it was applied on. -
@Quazz That is an intriguing method. Your editing the default NTUSER.dat file instead of just copying over a newly created one. Do you know what the theme contains? I was under the impression that the theme is just the desktop background and things of that nature. I know that the taskbar pins are a mix of something in the ntuser.dat hive and the shortcut icons in AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar. But I don’t know the exact part of the hive that sets that off the top of my head. Does your method customize the taskbar pins and toolbars? The start screen pins are also in a few database files that I have no idea how to edit manually (I have tried only a little), and I think that there are some linked registry hive entries for that too. I think there are still some files that need to be copied for full customization, but I kinda love the idea of editing the original ntuser.dat, but I didn’t think it was as simple as a few commands. I’ve loaded the hive in regedit before, but manual edits in that manner are risky and I ran into some things that were completely in binary.
Another thing I customize is a old fashioned startmenu. I figured this out with windows 8. Right click the taskbar and go to toolbars→new toolbar and point it to “%APPDATA%\Microsoft\Windows\Start Menu\Programs” This will point it to the current user’s start menu. I then customize that folder down to just a few organized folders with the installed programs. (I hide instead of deleting the default windows system shortcuts though, because otherwise sfc /scannow thinks they’re missing and restores them.) I also unlock the taskbar and move it over to the left (sometimes have to drag taskbar buttons to the right of it) then re-lock the taskbar and violia old fashioned start menu programs menu. None of this forcing alphabetic order without any subfolders and a bunch of windows apps you don’t care about (not that all windows apps are useless, they just aren’t really needed in a business environment). Granted, I believe that I did find a registry entry linked to that toolbar and it’s path and location on the taskbar. I tried to create it into a machine instead of user hive to no avail. But perhaps I might be able to utilize this method for the ntuser.dat.
TL;DR
Cool script, I’m going to take that idea and see if it improves the stability of my script for the ntuser.dat aspect. -
@Arrowhead-IT The theme sets system sounds and background such only, yes.
For taskbar pins, I simply copy over pre-created shortcut links to the appropriate folder.
Removing the default ones is trickier because there doesn’t seem to be a built-in way of accomplishing it.
I’m still working on a lot of this stuff, but I believe currently I simply remove them during setupcomplete from both the default and currently created user. I haven’t been able to test this out yet however.
“%SystemDrive%\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Windows Media Player.lnk” should be the path to the windows media player link for example.
-
@Arrowhead-IT
Below are the logs if you would like to take a look. I did build a fresh image and only made a few minor alterations to the source profile and tested it, and your script worked fine for me, the new profiles from that point on had working Cortana & Start Menu. So there must be something in this particular image that isn’t playing nice with your script, not exactly sure what it is though.
-
@Quazz said in Cortana/Windows Search breaks in default profile:
“%SystemDrive%\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Windows Media Player.lnk” should be the path to the windows media player link for example.
That is where the shortcut files go, but if you just put a shortcut there it won’t appear on the taskbar, and if you take one out it will just break the link. You have to have the registry entry in there too. I believe the reg key is all binary code and found in the ntuser.dat hive under Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband, so could copy that key from a customized profile in the HKCU hive to the default ntuser.dat hive along with the .lnk shortcut files in the appdata path and it would work.
@Wayne-Workman In your plans to re-write it, you might consider a batch function for each aspect with this registry method for the ntuser.dat file. Since my script simply copies the default profile folder to a share, adding in this method of editing the ntuser.dat leaving the original windows defaults in place might be a better practice. I would probably make a function with what Quazz shared for copying reg entries to the ntuser.dat hive. Then just have to figure out where each thing is in the registry. Task bar pins, theme, taskbar toolbars, windows explorer settings like not showing hidden files and showing this pc instead of recent as default. Stuff like that. It’s certainly easier to just copy the ntuser.dat file, but it would probably be a better practice to seperate them. Which could also make it possible to edit just one part of a given profile. I will probably play with this idea early next month myself, but I figured I’d share my ideas for rewriting.
The other question I want to find the answer to is how to set app defaults so they are set proper. That one doesn’t save in my profile script and has to be set manually for each user, which is rather annoying, especially with the win 10 1511 default app resets. P.s. I did find a reg key that fixes that elsewhere and have a script that applies the key on startup in my default profiles.
Windows Registry Editor Version 5.00 ;Description: Prevents Windows 10 from resetting the file associations ;... by setting NoOpenWith registry value for all the modern apps. ;Created on Feb 13 2016 by Ramesh Srinivasan ;The Winhelponline Blog ;Tested in Windows 10 Build 10586 ;http://www.winhelponline.com/blog ;------------------- ;Microsoft.3DBuilder ;------------------- ;File Types: .stl, .3mf, .obj, .wrl, .ply, .fbx, .3ds, .dae, .dxf, .bmp ;... .jpg, .png, .tga [HKEY_CURRENT_USER\SOFTWARE\Classes\AppXvhc4p7vz4b485xfp46hhk3fq3grkdgjg] "NoOpenWith"="" ;------------------- ;Microsoft Edge ;------------------- ;File Types: .htm, .html [HKEY_CURRENT_USER\SOFTWARE\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9] "NoOpenWith"="" ;File Types: .pdf [HKEY_CURRENT_USER\SOFTWARE\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723] "NoOpenWith"="" ;File Types: .svg [HKEY_CURRENT_USER\SOFTWARE\Classes\AppXde74bfzw9j31bzhcvsrxsyjnhhbq66cs] "NoOpenWith"="" ;File Types: .xml [HKEY_CURRENT_USER\SOFTWARE\Classes\AppXcc58vyzkbjbs4ky0mxrmxf8278rk9b3t] "NoOpenWith"="" ;------------------- ;Microsoft Photos ;------------------- ;File Types: .3g2,.3gp, .3gp2, .3gpp, .asf, .avi, .m2t, .m2ts, .m4v, .mkv ;... .mov, .mp4, mp4v, .mts, .tif, .tiff, .wmv [HKEY_CURRENT_USER\SOFTWARE\Classes\AppXk0g4vb8gvt7b93tg50ybcy892pge6jmt] "NoOpenWith"="" ;File Types: Most Image File Types [HKEY_CURRENT_USER\SOFTWARE\Classes\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc] "NoOpenWith"="" ;File Types: .raw, .rwl, .rw2 and others [HKEY_CURRENT_USER\SOFTWARE\Classes\AppX9rkaq77s0jzh1tyccadx9ghba15r6t3h] "NoOpenWith"="" ;------------------- ; Zune Music ;------------------- ;File Types: .aac, .adt, .adts ,.amr, .flac, .m3u, .m4a, .m4r, .mp3, .mpa ;.. .wav, .wma, .wpl, .zpl [HKEY_CURRENT_USER\SOFTWARE\Classes\AppXqj98qxeaynz6dv4459ayz6bnqxbyaqcs] "NoOpenWith"="" ;------------------- ; Zune Video ;------------------- ;File Types: .3g2,.3gp, .3gpp, .avi, .divx, .m2t, .m2ts, .m4v, .mkv, .mod ;... .mov, .mp4, mp4v, .mpe, .mpeg, .mpg, .mpv2, .mts, .tod, .ts ;... .tts, .wm, .wmv, .xvid [HKEY_CURRENT_USER\SOFTWARE\Classes\AppX6eg8h5sxqq90pv53845wmnbewywdqq5h] "NoOpenWith"=""
I am talented at Getting sidetracked. What was I replying to here? Whatever, it was all useful information right?
-
@csuther3 It looks like the profile was created right. You may want to try commenting out (rem or :: to comment in batch) or deleting the lines for the extra programs you don’t have. Basically all of the following in the
:AppData
function could be taken out because it’s for extra programs, I just left it in what I shared as an example of how to add user settings for other custom programs.call :copyDir "Saleslogix" "%cRoam%\Saleslogix" "%dRoam%\Saleslogix" call :copyDir "Sage Software" "%cRoam%\Sage Software" "%dRoam%\Sage Software" call :copyDir "Saleslogix" "%cLocal%\Saleslogix" "%dLocal%\Saleslogix" call :copyDir "Sage Software" "%cLocal%\Sage Software" "%dLocal%\Sage Software" rem IF %dept%==IT ( rem call :copyDir "Terminals" "%cLocal%\Robert_Chartier" "%dLocal%\Robert_Chartier" rem call :copyDir "VMware Vsphere" "%cLocal%\VMware" "%dLocal%\VMware" rem call :copyDir "VMware Vsphere" "%cRoam%\VMware" "%dRoam%\VMware" rem call :copyDir "Camtasia" "%cRoam%\TechSmith" "%dRoam%\TechSmith" rem call :copyDir "Camtasia" "%cLocal%\TechSmith" "%dLocal%\TechSmith" rem call :copyDir "slack" "%cLocal%\slack" "%dLocal%\slack" rem call :copyDir "ProgramFiles" %cPF% %dPF% rem ) call :copyDir "VLC settings" "%cRoam%\vlc" "%dRoam%\vlc" call :copyDir "FaxFinder settings" "%cRoam%\FaxFinder Client Software" "%dRoam%\FaxFinder Client Software"
A couple questions.
On the image that isn’t working, had you done anything to the default profile? It’s possible that you are copying stuff from there that you had tried before. Can I see the log from the apply where it didn’t work? It would be on the computer it was applied on and be called C:\defaultProfileApplied-ProfileName
That should show me what was copied from the profile.
My guess is that you just have some of the files that get created automatically still in the default profile folder and it’s copying them over.
I suppose it would be a good idea if I told the script to delete those directories before copying.Try this, hop into the appData folder of the profile that isn’t working on the profiles share. Make a backup copy of what you have, just a quick copy paste will do nicely. You’re going to delete anything that doesn’t match the following needed folders.
- In the root of
Roaming
You only needMicrosoft, Mozilla , *plus any custom program vendors*
- In the root of
Roaming\Microsoft
There should be only 2 foldersInternet Explorer
andWindows
Everything else should be deleted so it can be created by windows - In the root of
Roaming\Microsoft\Windows
Network Shortcuts, Printer Shortcuts, Recent, SendTo, Start Menu, Templates
Most of those folders are empty but should stay put (I’m fairly sure you can customize all of them to some degree, but I’ve only customized the start menu) - In the root of
Local
you should haveGoogle, Microsoft, Microsoft Help, MicrosoftEdge, Temp, TileDataLayer
temp should be empty - In the root of
Local\Microsoft
you should haveWindows *Plus outlook and or Office if you are trying to set customization's there*
- In the root of
Local\Microsoft\Windows
you should haveGameExplorer, History, INetCache, INetCookies, Shell, WinX
You can probably delete everything but Shell and WinX as the other dirs are empty, but this is what is currently in my most recently created deployable profile.
Sorry if that’s more information than you wanted. I just figure you probably have already put in a bunch of work into a profile that isn’t deploying. I know that was the case for me, this is how you fix it. Let me know if that does the trick. If it doesn’t then send me that log and we’ll see if we can’t make the profile work without redoing all the extra stuff.
- In the root of
-
@Arrowhead-IT
Thanks for all that, much appreciated…a few notes to follow up.
I haven’t tried re-executing the script with commenting out the lines you mentioned yet.
There doesn’t seem to be any C:\defaultProfileApplied-ProfileName file/folder on the PC I applied the profile to.
Your question about have I done anything to the default profile…the answer is yes. This image is actually a Win 7 upgrade, I was hoping to cheat a bit and save myself rebuilding the whole thing from scratch because it’s a pretty customized image.
Also, I modified your script slightly to make it run locally, for what I’m trying to accomplish I don’t really need the network functions. Attached is the modified version I’ve used. 0_1463771959294_CrDef.bat
I tried manually removing all of the folders you mentioned, but the Start Menu & Search still remains broken.
-
@csuther3 Wait you deleted the folders I mentioned or everything but the ones I mentioned. You were meant to the latter.
If this is a win 7 upgrade that may complicate things. You may need to take out just the pieces you need from the old profile to put them in a new one with the ntuser.dat registry hive using the load hive command @Quazz mentioned and then finding things like the task bar pins location and such.
You should be able to recreate just the profile in a fresh install of windows 10 and copy it over to the upgraded image. That should work too.
-
@Arrowhead-IT Sorry I misspoke, I kept the folders you mentioned and deleted the rest, but that didn’t change anything. I’m officially on vacation starting this evening, so I won’t get a chance to dig into this any deeper until I return. I’ll follow up at that time. Thanks for all your help!
-
I’ve been trying some stuff out regarding the taskbar icons and it’s frustrating to say the least.
It’s like windows either ignores or overrides the registry keys for the default user when you create a new user.
-
@Quazz arrowhead’s scripts do work. I can confirm this. The registry keys I mentioned about Win7 earlier in this thread are totally ignored by Win10 - I’ve already tried lol.
Microsoft takes one step forward, two steps back.
Their programmers are hard-coding values instead of using the registry that is ALREADY THERE! lol I hope someone from Microsoft reads this.
-
@Wayne-Workman So the script works for W7 and W10 default taskbar icons?
-
@Quazz Arrowhead’s scripts work for Win10. The methods I posted way back work for Win7.
-
@Arrowhead-IT can you make a git repo with your two scripts in it, with a read me and a GNU GPLv3 license?
-
@Arrowhead-IT @Wayne-Workman
I found some more interesting information on this subject: https://cwiki.apache.org/confluence/display/VCL/How+to+Configure+the+Windows+Default+User+Profile
They recommend deleting the shell items of the ntuser.dat if you copy it from a different profile.
-
@Quazz I’ve not done that, everything seems fine. I wonder what potential issues there could be? I’m not copying the default user’s registry entries, just the files I believe.
-
@Wayne-Workman Not sure what the copy profile thing actually transfers, but if ntuser.dat is part of it then that’s where the user’s registry keys are in.
You can test it by loading it in regedit and searching for the account it was transfered from.
I figure windows would alter that regardless upon account creation, though, so you may be right that it’s unnecessary.
-
@Wayne-Workman It seems like this is not necessary on Pro versions of Windows, but it is on Home Premium! At least that’s how my test situations have turned out so far. In Home Premium it seems to copy over literally everything and in Pro it is more clever about it.