I'm having a simple PowerShell script which import a certificate:
$certificate_file_name = "C:\Files\Plugins\certi1.cer"
$root_cert_folder_path = 'Cert:\LocalMachine\Root'
try
{
$certificate_obj = Import-Certificate -FilePath $certificate_file_name -CertStoreLocation $root_cert_folder_path
}
catch
{
$ErrorMessage = $_.Exception.Message
write-output $ErrorMessage
}
When running the script manually - it's working fine.
In addition, I have an installshield project that have 1 action item - executing the above script.
After building the installer and running it I get the error `The 'Import-Certificate' command was found in the module 'PKI', but the module could not be loaded. For more information, run 'Import-Module PKI'.
Why does it happens? How can it be solved? `