Hello Abhinay,
Here are few things that are worth mentioning:
1- in order to import a certificate using PowerShell, you will need to run the PowerShell console elevated. With that being said, it means that your package must also be run elevated ("Install Parameters" page --> "Run as administrator").
2- the path to LocalMachine\Personal store is the following:
3- since you have added your certification file in
"Files and Folders" page, you should schedule your custom action after the "Add resources" action group (because during the "Add resources" action group, the files are copied on the target machine). Beside that, your custom action's execution time must be
"When the system is being modified (deferred)".
Here is a little sample script which installs a .pfx certificate in the LocalMachine\Personal store:
Code: Select all
$certLocation = "$appdir" + "\CaphyonTestCertificate.pfx"
Import-PfxCertificate -Filepath $certLocation -CertStoreLocation cert:\LocalMachine\My
where $appDir is a variable which stores the value of the [APPDIR] property.
I will attach a screenshot for your reference where I will highlight all the settings that need to be done:
- CertPS.PNG (67.94 KiB) Viewed 4047 times
Hope this helps.
All the best,
Catalin