0

i need to be able to log in as an administrator and run a powershell script so that it affects all users registry keys.

i have a powershell script that fixes the TWINUI issue. It resets the corrupted registry keys of a users defualt apps back to standard. it only really seems to work if the user is temporarily made a local admin on the device and run it from that login. Obviously removing their local admin privlages afterward.

this issue seems to crop up constantly and when it happens on one user on a device it happens for multiple users. going through every user on a device can be time consuming. if i could log in as an administrator and run the powershell and it go through all the affected registry keys of all the users it could save us a lot of time.

5
  • Show us your code. What keys are you modifying? May 30, 2020 at 0:24
  • the registry for an account does not exist in memory when an account is not logged in. you can either load the hive file and work with that - one account at time, OR possibly use jobs to do the preceding in parallel, OR set up a scheduled task to do the work when the user logs in.
    – Lee_Dailey
    May 30, 2020 at 1:33
  • Normally this is done with Group Policy's Logon Scripts. Ask at serverfault.com.
    – Mark
    May 30, 2020 at 5:48
  • Jason - Are you in an AD/domain environment where you have domain group policies to work with specifically. If not, then knowing how to do this with local group policy and logon script, etc. might just be on topic. This is a Windows issue with the TWINUI or whatever and I recall something similar and fixing it with logon script with similar logic in an answer here: superuser.com/questions/1481644/… which I wrote about. Perhaps it's a matter of which PowerShell commands and parameters you are using. Give that a shot May 30, 2020 at 6:00
  • There are many ways to have PS run as a logon script and silently without being visible and without needing to use domain or AD or even Group Policies to do it, and for every user account that logs on. So for those with such criteria, it would be a disservice to the SU community to not allow such content be post here if it's truly not (or perhaps not just) for a server configuration. I'm a fan of giving people time to clarify when the question for clarification is actually asked. May 30, 2020 at 6:02

1 Answer 1

0

So the generally accepted fix for the TWINUI issue is to re-register all of that user's AppxPackages using the below command. This does not seem to require admin credentials, but only applies to the current user:

Get-AppXPackage | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

However, to do this for all users, just specify -allusers when searching for packages, and run as an administrator:

Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

Unfortunately, I don't have a way to test this out, so your mileage may vary.

See this forum post or this TechNet article for more details. This seems to take quite a while, and resets the windows UI process a few times/causes the screen to blink/etc. I would avoid doing this as a GPO or scheduled task for users.

2
  • The author isn't looking for a solution to the TWIINUI issue, they already have a solution, they are just running into the problem their solution requires the user to be an Administrator.
    – Ramhound
    Jun 1, 2020 at 14:19
  • I'm inferring what their solution is (not ideal, but not in the post), and answering the question in the last sentence about a single command to fix the issue for all users with a single admin command.
    – Cpt.Whale
    Jun 1, 2020 at 14:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .