Windows 2012r2 中缺少 Powershell New-SelfSignedCertificate -NotBefore

Zon*_*nus 1 ssl-certificate windows-server-2012-r2 self-signed-certificate

我的 2008 powershell 脚本在 2012r2 中无法正常工作。命令

New-SelfSignedCertificate -DnsName test.testdomain.com -NotBefore [datetime]::now.AddYears(10) 
Run Code Online (Sandbox Code Playgroud)

回来了:

New-SelfSignedCertificate : A parameter cannot be found that matches parameter name 'NotBefore'
Run Code Online (Sandbox Code Playgroud)

作为测试,我在 Windows 10 中运行正常...

我不会(无法)下载旧版本的 selfssl 来执行此操作(是的,我知道这一点)。它需要在powershell中完成,否则我将不得不在另一个盒子上的openssl中查看这些证书。

有谁知道这是怎么回事?

Cry*_*t32 6

正如 Sam 所提到的,此参数是在 Windows 10 中引入的,在以前的版本中不可用。

作为替代解决方案,我建议使用我多年前编写的自定义 PowerShell 脚本:https : //gallery.technet.microsoft.com/scriptcenter/Self-signed-certificate-5920a7c6 该页面包含所有参数说明和使用示例。

HTH