Powershell New-SelfSignedCertificate missing -NotBefore in Windows 2012r2
Solution 1
As Sam mentioned, this parameter was introduced in Windows 10 and is not available on previous versions.
As an alternative solution, I would suggest a custom PowerShell script I wrote years ago: https://gallery.technet.microsoft.com/scriptcenter/Self-signed-certificate-5920a7c6 the page contains all parameter description and usage examples.
HTH
Solution 2
NotBefore is only available in Windows 10/Server 2016 Technical preview. If you look at this page and change the OS in the drop down you will see it is not present for 2012 R2.
Related videos on Youtube
Zonus
Updated on September 18, 2022Comments
-
Zonus almost 2 years
My 2008 powershell script is not working correctly in 2012r2. The command
New-SelfSignedCertificate -DnsName test.testdomain.com -NotBefore [datetime]::now.AddYears(10)
comes back with:
New-SelfSignedCertificate : A parameter cannot be found that matches parameter name 'NotBefore'
I ran this ok in Windows 10 as a test...
I do not (cannot) download an old version of selfssl to perform this (yes I know about this). It needs to be done in powershell or I'll have to look at gemerating these certs in openssl on another box.
Anyone know what is going on with this?
-
pat o. over 8 yearsPossible duplicate of IIS 7.5 Creating self signed certificates with validation date of more than a year
-
Zonus over 8 yearsNot a dup. I know about selfssl; it has to be powershell or I'll have to do this in openssl on another box and copy over the cert. (I really hope I don't have to do that)
-
-
Zonus over 8 yearsWell humdinger... Is there another way in powershell do this?
-
user5870571 over 8 yearsWhy don't you copy the PS module from 10 and put it on the 2012 server?
-
XuShaocong about 7 yearsThe script is great, I used this as a basis for my scripts, but was it unfinished? I see StoreName as a parameter mentioned but not in the script, and StoreLocation is a bit more hardcoded. My main miss on the 2016 is is the "-signer" tag, though.
-
ArgeKumandan about 6 yearshow do we use this script?