How to run AddSslCertificate in PowerShell to bind a new certificate

Charles Tang 45 Reputation points

Try to use PowerShell script to bind a new certificate, but AddSslCertificate failed. Can you help?

Import-Module WebAdministration
$bindings = Get-WebBinding
Write-Host $bindings 

Get-WebBinding |
    Foreach-Object {
Got the following output with warning and error:

WARNING: Module WebAdministration is loaded in Windows PowerShell using WinPSCompatSession remoting session; please note that all input and output of commands from this module will be deserialized objects. If you want to load this module into PowerShell please use 'Import-Module -SkipEditionCheck' syntax.

https * sslFlags=1 https * sslFlags=1 https * sslFlags=1

Line |
  26 |      Foreach-Object {
     |      ~~~~~~~~~~~~~~~~
     | Method invocation failed because
     | [Deserialized.Microsoft.IIs.PowerShell.Framework.ConfigurationElement#bindings#binding] does not contain a
     | method named 'AddSslCertificate'.
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,152 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 45,111 Reputation points

    Did you follow the suggestion in the "WARNING:" message?

    If you want to load this module into PowerShell please use 'Import-Module -SkipEditionCheck' syntax.

    Deserialized objects don't have methods. They're text-only.

0 additional answers

Sort by: Most helpful