microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
109.73k stars 6.46k forks source link

[Installer] Runner.exe loop after install as different user #17720

Closed htcfreek closed 2 years ago

htcfreek commented 2 years ago

Microsoft PowerToys version

0.57.2

Running as admin

Area(s) with issue?

Installer

Steps to reproduce

  1. Exit PT Run.
  2. Execute setup.exe form normal user with run as user by using credentials of an admin account.

✔️ Expected Behavior

After installation the runner starts correctly or I can uncheck start after install on setup screen.

❌ Actual Behavior

Runner hang in loop.

[2022-04-13 09:28:29.056366] [p-15212] [t-9000] [info] runner logger is initialized
[2022-04-13 09:28:29.056389] [p-15212] [t-9000] [info] Running powertoys with cmd args: --dont-elevate
[2022-04-13 09:28:29.057179] [p-15212] [t-9000] [info] apply_general_settings: {"startup":false,"enabled":{"AlwaysOnTop":true,"Awake":true,"ColorPicker":true,"FancyZones":true,"File Explorer":true,"FindMyMouse":true,"Image Resizer":true,"Keyboard Manager":true,"MouseHighlighter":true,"MousePointerCrosshairs":false,"PowerRename":true,"PowerToys Run":false,"Shortcut Guide":true,"Video Conference":false},"is_elevated":true,"run_elevated":false,"download_updates_automatically":true,"is_admin":true,"theme":"system","system_theme":"light","powertoys_version":"v0.55.0"}
[2022-04-13 09:28:29.077625] [p-15212] [t-9000] [info] Scheduling restart as non elevated
[2022-04-13 09:28:29.077703] [p-15212] [t-9000] [info] run_non_elevated with params=--dont-elevate
[2022-04-13 09:28:29.078191] [p-15212] [t-9000] [error] OpenProcess() failed. Zugriff verweigert
[2022-04-13 09:28:29.078196] [p-15212] [t-9000] [warning] Scheduled restart failed. Trying restart as admin as fallback...

runner-log_2022-04-13.txt

Other Software

No response

htcfreek commented 2 years ago

cc: @yuyoyuppe

rwhitt-jumptrading commented 2 years ago

We experienced this issue as well. Since we used SCCM and PatchMyPC this used the EXE version. MSI version does not seem to have the issue.

The devices affected by this issue had millions of processes spawned, which in turn ate up GB's of log files in the Runner log file location. This also caused Windows Defender to spin up and saturate the CPU.

Ultimately we created a post-install script to change the permissions so that powertoys.exe could not launch, then added permissions back after a 5-second delay. This basically mimicked a reboot which also solved this for users. We also did a bit of log file cleanup to delete all the generated log files.

Hopefully, we can get a new version of this out soon so we can remove the post-install script we have in place. Hope this also helps anyone else in this situation.

rwhitt-jumptrading commented 2 years ago

Some additional information - `New EXE Installer from version 0.55.0 onwards (Previously was extracting the MSI and deploying that via SCCM This Installer doesn't like trying to start PowerToys for the first time as a non-elevated User coming from the elevated installer. When it does it just loops and crashes.

[2022-04-12 11:09:38.477270] [p-8792] [t-11412] [info] runner logger is initialized [2022-04-12 11:09:38.477286] [p-8792] [t-11412] [info] Running powertoys with cmd args: --dont-elevate [2022-04-12 11:09:38.477771] [p-8792] [t-11412] [info] apply_general_settings: {"startup":false,"enabled":{"AlwaysOnTop":true,"Awake":true,"ColorPicker":true,"FancyZones":true,"File Explorer":true,"FindMyMouse":true,"Image Resizer":true,"Keyboard Manager":true,"MouseHighlighter":true,"MousePointerCrosshairs":false,"PowerRename":true,"PowerToys Run":true,"Shortcut Guide":true,"Video Conference":false},"is_elevated":true,"run_elevated":false,"download_updates_automatically":true,"is_admin":true,"theme":"system","system_theme":"light","powertoys_version":"v0.56.1"} [2022-04-12 11:09:38.480636] [p-8792] [t-11412] [info] Scheduling restart as non elevated [2022-04-12 11:09:38.480737] [p-8792] [t-11412] [info] run_non_elevated with params=--dont-elevate [2022-04-12 11:09:38.480740] [p-8792] [t-11412] [warning] GetShellWindow() returned null. Shell window is not available [2022-04-12 11:09:38.480742] [p-8792] [t-11412] [warning] Scheduled restart failed. Trying restart as admin as fallback...

During this time you can start PowerToys manually and it runs, but the process keeps bombing out in the background. Once the machine is rebooted, this goes away, as the "FirstRun" process is gone.

We run PatchMyPC with /s /noreboot. So the machine will ALWAYS loop.

Why we didn't see this before, was that IF you install it NOT via the Exe but via the inbuilt PowerToys Update (Needs Admin credentials) This looping process doesn't happen.`

jaimecbernardo commented 2 years ago

In https://github.com/microsoft/PowerToys/issues/17731 it seems this can occur for admin users with UAC off.

jaimecbernardo commented 2 years ago

Another case of how this could happen: https://github.com/microsoft/PowerToys/issues/8419#issuecomment-1100961539

htcfreek commented 2 years ago

Shipped with 0.58.0