locked
[C#] How to remove credentials during or after msi uninstall? RRS feed

  • Question

  • Hello.

    I created msi using setup project of visual studio.

    Installed program does add credentials.

    I need to remove credentials during or after uninstall.

    Credentials are added as logged in user account and Windows Installer is executed as SYSTEM account. 

    I added code in AfterUninstall of Installer Class for removing credentials, but it does only access credential under SYSTEM account.

    I created the Windows service program to watch programs exist and I tried to remove credentials from the Windows service program.

    I generated batch file to remove credentials.

    The Windows service program is executed as SYSTEM account. 

    It is can't access credentials of current user account.

    How I can remove credentials under user account from Windows service under SYSTEM account?

    Or how I can run batch file as user account from Windows service under SYSTEM account?

    Sunday, April 5, 2020 9:29 AM

All replies

  • Hello,

    Since the service is running as system it can not perform this action nor can a batch file spawn from the service. This needs to be done in a installer/uninstall app with proper permissions, in this case of the user in regards to a personal computer.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, April 7, 2020 11:19 PM