0

First of all, this is one of those borderline questions between serverfault and superuser. In the end, I decided it belonged here because of the fact that most aspects of it revolve around a domain environment.

As another Caveat, this is a very specific scenario to a very general question. If just the question itself were being asked, the obvious answer would be to use a Startup Script rather than a Logon Script. But, that's not really an option here.

First of all, the ultimate goal of this is, quite simply, to achieve true roaming profile deployment in Windows 10, Without having to resort to a third party app. Coming down to the home stretch in this design, we approached the final hurdle, and it was a real hurdle. How do we roam the start menu?

After many, and I do mean many, different ideas and trials, we figured out what does work.

Copying the %LocalAppData%\TileDataLayer\Database folder

Great, so I can copy this entire folder to a network share and recopy it to any computer to get a truly roaming start menu. Now, I want to automate this process using a logon script to copy from the share and a logoff script to copy to the share. Easy, right? Wrong, in order to copy the folder you must first stop the "Tile Data Model Server" service (which by the way only stops for a fraction of a second then auto starts again).

Now, we come to the crux of the problem. The Net Stop command requires you to be running an elevated prompt, the logon/logoff scripts only run in the local user context and a Startup/Shutdown script isn't going to be able to copy a specific user's start menu. Obviously, I can't split this into two separate scripts and shove one in Startup and one in Logon, because the service only stops for a split second.

Ultimately, my current idea is to either find some way to run net stop elevated in an unelevated prompt, or have the command run without elevation. Is there a way to do either? Or, is there a simpler way to get that folder to roam?

I am intimately aware of the workaround of running the script as a scheduled task, but find this to be a terrible solution.

Naryna
  • 271
  • 1
  • 3
  • 13

1 Answers1

0

Since it's a service that you're able to stop, then have the script disable the service, stop it, copy what you need, re-enable it, and then start it. In order to disable the service, you'll need to play with the registry.


Here, there be dragons.
The following contains potentially hazardous information. Proceed at your own risk.

Export the following key to a file you can access: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tiledatamodelsvc and save this 'clean' key in a safe location. Next remove everything but the ImagePath line(s) and then alter that line to read something else, such as: %systemroot%\system32\svchostNOMORE.exe -k appmodel and then save this 'corrupted' key to a different location somewhere safe where normal users can't get to it.

reg import "Path to 'corrupted' registry key"
net stop  "ServiceName"
copy PathtoServer PathtoLocalStorage
reg import "Path to 'clean' registry key"
net start "Servicename"

It's possible that this could temporarily break the Star Menu, but I was able to simply kill explorer with taskkill /f /im explorer.exe and then restart it with explorer.exe and the Start Menu worked again. I didn't modify any of the tile data though, so your mileage may vary.

Blerg
  • 126
  • 2
  • This is actually a great bit of information, but sort of bypasses the actual problem I'm having and wanted to solve. The script works just fine by simply stopping and copying the service, but Net Stop doesn't run without the prompt being elevated and logon scripts don't do that. Unless all the registry changes somehow fix that. – Naryna Jun 24 '16 at 15:39
  • `Obviously, I can't split this into two separate scripts and shove one in Startup and one in Logon, because the service only stops for a split second.` Could you please explain that portion of your question then? You have a domain, so you should be able to run scripts as a different user, or you could add the batch file to a .msi file and have the domain install it on login as well. – Blerg Jun 24 '16 at 19:00