I think this is what you want:
$w3svc = "W3SVC/566412209"
$pfxPath = "c:\ssl\myssl.pfx"
$pfxPassword = "password123"
$certMgr = New-Object -ComObject IIS.CertObj
$certMgr.ServerName = [System.Environment]::MachineName
$certMgr.InstanceName = $w3svc
$certMgr.Import($pfxPath, $pfxPassword, $true, $true)
You can also create a .NET Interop assembly (by adding a COM link to C:\WINDOWS\system32\inetsrv\certobj.dllor using tlbimp.exe) so that you can use it with PowerShell and .NET projects:
[void][reflection.assembly]::loadfrom("Interop.CERTOBJLib.dll")
$certMgr = new-object -typeName CERTOBJLib.IISCertObjClass
$certMgr.ServerName = [System.Environment]::MachineName
$certMgr.InstanceName = $w3svc
$certMgr.Import($pfxPath, $pfxPassword, $true, $true)
- SSL , .
MS docs IIS.CertObj :
IISCertObj (IIS 6.0)