Exe running several times in background, even when closed

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Post Reply
User avatar
stevens
Posts: 334
Joined: Wed Jun 15, 2016 2:26 am

Exe running several times in background, even when closed

Post by stevens » Wed May 16, 2018 7:24 am

Hi,

Quick question, if I run my Powershell Studio Project exe and close it, I can see in processes that it is still running.
Can't alt + tab to it, but the process(es) is(are) still here.

Something I can do about this?
Please advise.
S.

User avatar
jvierra
Posts: 12183
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Exe running several times in background, even when closed

Post by jvierra » Wed May 16, 2018 7:27 am

Have you tried fixing your code. A form can hide and still not close which might prevent the EXE from exiting.

User avatar
Alexander Riedel
Posts: 6516
Joined: Tue May 29, 2007 4:43 pm

Re: Exe running several times in background, even when closed

Post by Alexander Riedel » Wed May 16, 2018 7:28 am

.Net processes can take a few seconds to close down. It is is longer than that you leave resources open. Make sure you exit loops, close jobs, close files and close forms.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
stevens
Posts: 334
Joined: Wed Jun 15, 2016 2:26 am

Re: Exe running several times in background, even when closed

Post by stevens » Wed May 16, 2018 8:06 am

Thanks Alexander, strange thing is that it is only on Windows 2016, not on Windows 2012 server.

User avatar
Alexander Riedel
Posts: 6516
Joined: Tue May 29, 2007 4:43 pm

Re: Exe running several times in background, even when closed

Post by Alexander Riedel » Wed May 16, 2018 8:18 am

I don't know your code, so its not possible to tell :D
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
stevens
Posts: 334
Joined: Wed Jun 15, 2016 2:26 am

Re: Exe running several times in background, even when closed

Post by stevens » Wed May 16, 2018 8:59 am

There is nothing special to it, I close the project with the x of the form. It closes correctly on Windows 2012, not on 2016.

User avatar
Alexander Riedel
Posts: 6516
Joined: Tue May 29, 2007 4:43 pm

Re: Exe running several times in background, even when closed

Post by Alexander Riedel » Wed May 16, 2018 9:04 am

Probably loading a different version of a module and the newer version is not terminating unless you kick it out with Remove-Module
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 6516
Joined: Tue May 29, 2007 4:43 pm

Re: Exe running several times in background, even when closed

Post by Alexander Riedel » Wed May 16, 2018 9:28 am

Are you using PSUtils?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
jvierra
Posts: 12183
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Exe running several times in background, even when closed

Post by jvierra » Wed May 16, 2018 4:09 pm

Windows 2010 and later do not necessarily remove a process from memory. Since W10 processes can remain dormant in memory even after they are close. All "Store" apps will stay in memory after they are closed. Non-store apps can also stay in memory.

I have not yet been able to track down the rules that govern this. Edge will remain in memory always after first execution. IE will stay in memory if certain COM objects have been activated. It is not clear if this is intended or some side-effect of the COM objects being used.

If you are using Excel or other Office apps via COM then this can cause your app to remain in memory.

This behavior is new to W10 and later systems.

There may be other causes of this behavior.

User avatar
stevens
Posts: 334
Joined: Wed Jun 15, 2016 2:26 am

Re: Exe running several times in background, even when closed

Post by stevens » Thu May 24, 2018 1:10 am

Thanks for the update. That could explain things.

Note not related to this question: why are my other posts "locked" again -had this in the past also-?
Wanted to update my post on jobargs (can't open the example you posted, get message "Test-JobArgs.psf: Unable to load Test-JobArgs.psf (File Format: v3.1), because it was created with a different version of SAPIEN PowerShell Studio 2017") ... but it is locked.

Post Reply