需要自签名证书 Win2012 r2 SHA256 4年到期

Need Self-Signed Certificate Win2012 r2 SHA256 4-year expiration

今天下午大部分时间我都在想办法解决这个问题,所以我很可能遗漏了一些简单的东西。

我需要在 Windows Server 2012 R2 上创建一个 SHA256、2048 位且四年都不会过期的自签名证书。

根据我的搜索,我发现 PowerShell (PS) 是可行的方法,并且看到了合理数量的示例 - none 其中有我需要的一切。

例如,我尝试搜索 PS 命令 New-SelfSignedCertificate 并添加“-NotAfter”选项,但我收到错误消息 "A parameter cannot be found that matches parameter name 'NotAfter'."

即使我在这里看到“[-NotAfter]”:https://technet.microsoft.com/en-us/itpro/powershell/windows/pkiclient/new-selfsignedcertificate(并且该文章有 2017 年 3 月的更新)

我试过几个 PS 人们写的脚本,这些脚本似乎适用于 1 年以上的日期,但它们都不适用于上述标准之一,无论如何,不要出现在 IIS 8.5 中让我将它们绑定到站点(我在服务器上创建)。

$psversiontable 在服务器上给出 "PSVersion" = 5.0.10586.117

在此先感谢您的帮助!

New-SelfSignedCertificate (PKIClient module) cmdlet with advanced parameters is available starting from Windows Server 2016. The article 您提到的仅适用于 Server 2016。

在 Windows 2012/2012 R2 中你只有这个 东西New-SelfSignedCertificate (PKI module)。没用。

您可以尝试使用 CertReq utility,但它 不利于自动化