Programmatically install certificate on windows8

159 Views Asked by At

I am aiming to install a certificate on Windows 8 using a ".exe" application, I have the common problem of "Access denied".

Installing the certificate for CurrentUser works well but doesn't let the program install a Windows Store Application in a second step, saying that the certificate isn't found.

I have to install it for LocalMachine then! (with manual install of the certificate the program installed the Windows Store Application)

Note that on Windows 7 the problem doesn't occur ...

Have you found any solution for this? Thanks

2

There are 2 best solutions below

1
On

You need to have administrative privileges in order to install into the localmachine certificate store. Is your program which installs the certificate running elevated?

0
On

I was using WiX installer with a custom action and had a similar problem when installing certificate.

The problem was that the custom action was setup to run in Execute='immediate' which make the custom action run in user privileges. The installer fails to install certificate in Windows 8.

The solution that worked for me was to run the custom action in deferred mode. This will ensure that the custom action runs with elevated privileges and works ok in Windows 8.

Hope this helps.

Regards,

Ram