Powershell command
In the following command, aren't there values that need to be put into some of these areas, such as "Byte" and also "-ReadCount" ? Please help. Are these the size of the file in bytes?? Import-ExchangeCertificate -FileData ([Byte[]]$(Get-Content -Path C:\Certificates\mail1-certificate.pfx -Encoding Byte -ReadCount 0)) | Enable-ExchangeCertificate -Services SMTP
July 18th, 2012 5:39pm

I believe that "[Byte[]]" declares that the output of the Get-Content cmdlet is returned as an array of bytes, which is what the -FileData parameter needs. Your command looks correct assuming that the path to the certificate is correct and you are using Exchange 2010, and no further futzing around with the cmdlet should be necessary.Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
Free Windows Admin Tool Kit Click here and download it now
July 18th, 2012 5:46pm

Thanks for the reply. I get this error when I run the command. (the path to the cert is correct). Maybe it's not my syntax, and the cert is actually not able to import. Import_ExchangeCertificate : The source data cannot be imported or the wrong password was specified. There's more I'll add it tomorrow.
July 18th, 2012 7:23pm

Hi Steve, When you going to import an existing certificate and private key from .pfx file, you can use this command: Import-ExchangeCertificate -FileData ([Byte[]]$(Get-Content -Path c:\certificates\ExportedCert.pfx -Encoding byte -ReadCount 0)) -Password:(Get-Credential).password|Enable-ExchangeCertificate -Services SMTP You can know information from this document: Import-ExchangeCertificate http://technet.microsoft.com/en-us/library/bb124424 Thanks, EvanEvan Liu TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
July 18th, 2012 11:03pm

Hi Steve, When you going to import an existing certificate and private key from .pfx file, you can use this command: Import-ExchangeCertificate -FileData ([Byte[]]$(Get-Content -Path c:\certificates\ExportedCert.pfx -Encoding byte -ReadCount 0)) -Password:(Get-Credential).password|Enable-ExchangeCertificate -Services SMTP You can know information from this document: Import-ExchangeCertificate http://technet.microsoft.com/en-us/library/bb124424 Thanks, EvanEvan Liu TechNet Community Support
July 18th, 2012 11:03pm

Oh, you're importing a PFX file. It has a password. Look at Example 1 in the following link for the proper use of the -Password parameter. http://technet.microsoft.com/en-us/library/bb124424.aspx By the way, the Certificate Wizard in the Exchange Management Console is so good that it's one of the few places I prefer over the shell.Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
Free Windows Admin Tool Kit Click here and download it now
July 19th, 2012 12:52am

Oh, you're importing a PFX file. It has a password. Look at Example 1 in the following link for the proper use of the -Password parameter. http://technet.microsoft.com/en-us/library/bb124424.aspx By the way, the Certificate Wizard in the Exchange Management Console is so good that it's one of the few places I prefer over the shell.Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
July 19th, 2012 12:52am

Awesome, thanks! That worked for me. Also, when using the -password parameter, article states that you don't need to include a username, but that did not work for me. I entered the local admin account I was using on the server, along with the .PFX password.
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2012 4:07pm

Yeah, when I document the process, I always say to enter "any" as the user name.Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
July 24th, 2012 12:03am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics