electron-builder: NSIS install fails on terminal servers with multiple users already running the program

22.11.7

Which version of node are you using? 14.17.1

Which version of electron are you using? 8.5.5

Which version of electron-updater are you using (if applicable)? 4.3.9

For which target are you building for?

"win": {
            "icon": "resources/icons/win/icon.ico",
            "target": {
                "target": "nsis-web",
                "arch": [
                    "ia32",
                    "x64"
                ]
            },
            "artifactName": "${name}_setup_${version}.${ext}"
        },
        "nsisWeb": {
            "createDesktopShortcut": false,
            "createStartMenuShortcut": true,
            "menuCategory": true,
            "guid": "com.update-test",
            "perMachine": false,
            "allowElevation": true,
            "differentialPackage": true,
            "uninstallDisplayName": "${productName}",
            "runAfterFinish": true,
            "oneClick": true,
            "allowToChangeInstallationDirectory": false
        },

The issue I am having is the NSIS installer incorrectly determines the application is still running on terminal servers if any user has it open, even when using per user. This blocks the install most of the time, or worse yet, auto kills all instances on the terminal server for all users when one user wants to update their individual install. Both of these are serious bugs. The installer should not check processes for other users when it is installed to one user folder. And it absolutely should not be able to kill the process for other users.

To reproduce. Build an NSIS-web installer. Connect to a terminal server with 2 different users. Install and run the application one one user. Then try to install on the other, it will fail. image On the right is the application running on a terminal server user. On the left is the installer trying to run on the same server but a different user

Is there a way to disable to is running check with a custom nsis script or anything? We encountered this bug during a large deployment which we have now paused.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 23 (8 by maintainers)

Commits related to this issue

Most upvoted comments

elevated instance of current user is detected, but not closed while non-elevated installer continues.

Found that said behaviour has been there from before I made changes.

Anyway, this could be a cause of what @TDola reported, I mean, random closing of processes. I fixed this and opened a PR #6472

Um, no, this isn’t enough. If current user have the app running, this will kill other users instances too. On per-user install, I have to add /FI "USERNAME eq %USERNAME%" to taskkill too. So it won’t kill everyone’s app. I’ll add some lines tomorrow.

@Simolation Sort of yeah. As long as in app you still run the quit and update function it still works fine.
It’s working for me now. I have tested what happens if you leave it open, and it just errors trying to install. Not a great solution but if your head is under the gun too, it might be the best solution for now until the electron-builder team fixes the issue.

Should be possible to check if the app is running and what user is running it. Only close the current users versions.

Something like this powershell command gives the user ID with the app

Get-WmiObject -Class Win32_Process | 
    Select-Object Name,Path, @{ 
        Name = 'Owner'
        Expression = { 
            $_.GetOwner().User 
        }
    }

I’m not too familiar with nsis scripting either. Just picking it up while I go tbh.

I don’t foresee that causing any issues, but then again, I also wasn’t expecting this use case where multiple users are concurrently using different instances of the app on the same terminal server. I’d give it a go though and see if it suits your purposes.

Well it change made everyone happy again so I guess that worked. Should I leave this issue open because the solution was just bypassing electron-builders nsis script and it should still be fixed?