Asked by:
using -confirm parameter when -importcertificate

Question
-
Good evening all,
i am using the import-certificate command in powershell but get an additional prompt asking me if i am sure i want to add the certificate.
unfortunately the application i need it for seems to put the certs in the trusted user store by design which creates this prompt.
i am following this article - https://docs.microsoft.com/en-us/powershell/module/pkiclient/import-certificate?view=win10-ps
i can see a -confirm switch, can anyone advise where i add this to the below script and what parameter to use to suppress any prompts?
$file = ( Get-ChildItem -Path C:\Certs\Test.cer )
$file | Import-Certificate -CertStoreLocation cert:\CurrentUser\RootThank you!
Tuesday, June 12, 2018 5:40 PM
All replies
-
Import-Certificate -CertStoreLocation cert:\CurrentUser\My -FilePath $file
\_(ツ)_/
Tuesday, June 12, 2018 6:15 PM -
Import-Certificate -CertStoreLocation cert:\CurrentUser\My -FilePath $file
\_(ツ)_/
Hello
i get that but how do i suppress the prompt using -confirm ?
Regards
Tuesday, June 12, 2018 6:22 PM -
Confirm is a switch. Just add it. Note that you cannot suppress security warnings.
\_(ツ)_/
Tuesday, June 12, 2018 6:28 PM -
Confirm is a switch. Just add it. Note that you cannot suppress security warnings.
\_(ツ)_/
you cant? why is that do you know?
it doesnt allow a silent installation?
Tuesday, June 12, 2018 6:31 PM -
See the following for a discussion on such things.
\_(ツ)_/
Tuesday, June 12, 2018 6:35 PM -
You can also try this but it doesn't work on all CmdLets:
$ConfirmPreference = [System.Management.Automation.ConfirmImpact]::None
or
$ConfirmPreference = [System.Management.Automation.ConfirmImpact]::Low
\_(ツ)_/
- Edited by jrv Tuesday, June 12, 2018 6:38 PM
Tuesday, June 12, 2018 6:38 PM