Alex Posted May 29, 2020 #1 Share Posted May 29, 2020 Hi, I would like to export a remote connector client certificate via powershell. Connect-IpPbx $u = Get-IpPbxUser -UserId 14 $c = Get-IpPbxClientCertificate -UserEntry $u Ok now I have a X509Certificate Object. But how can I write this as pfx to a file? Thx Alex Link to comment Share on other sites More sharing options...
Most Valued User Solution Sebastian Dreier Posted May 29, 2020 Most Valued User Solution #2 Share Posted May 29, 2020 Hello Alex, the following Powershell snippet should solve your problem 😄 Connect-IpPbx $destinationFilePath = Join-Path -Path $env:USERPROFILE "Downloads\Sebastian.pfx" $cert = Get-IpPbxUser -UserName Sebastian | Get-IpPbxClientCertificate $certData = $cert.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Pfx, "123456") [System.IO.File]::WriteAllBytes($destinationFilePath, $certData) Disconnect-IpPbx Link to comment Share on other sites More sharing options...
Most Valued User Martin Posted May 29, 2020 Most Valued User #3 Share Posted May 29, 2020 There's an easier way using built-in PowerShell functionality ;-) Export-PfxCertificate -Cert $c -Password (Read-Host -Prompt "Password" -AsSecureString) -FilePath ./clientcert.pfx Link to comment Share on other sites More sharing options...
Alex Posted May 29, 2020 Author #4 Share Posted May 29, 2020 Thx Sebastian and Martin. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now