Powershell New-SelfSignedCertificate missing -NotBefore in Windows 2012r2

14,955

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.

Share:
14,955

Related videos on Youtube

Zonus
Author by

Zonus

Updated on September 18, 2022

Comments

  • Zonus
    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?

  • Zonus
    Zonus over 8 years
    Well humdinger... Is there another way in powershell do this?
  • user5870571
    user5870571 over 8 years
    Why don't you copy the PS module from 10 and put it on the 2012 server?
  • XuShaocong
    XuShaocong about 7 years
    The 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
    ArgeKumandan about 6 years
    how do we use this script?