1

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?

2

2 Answers 2

6

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

5
  • 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. May 16, 2017 at 13:54
  • how do we use this script? Apr 11, 2018 at 20:12
  • 404 - Page not found!!!!!
    – G_Style
    Feb 7 at 14:38
  • @G_Style PS gallery is wiped by Microsoft.
    – Crypt32
    Feb 7 at 15:14
  • Obviously... :)
    – G_Style
    Feb 7 at 22:23
3

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.

3
  • Well humdinger... Is there another way in powershell do this?
    – Zonus
    Mar 7, 2016 at 21:20
  • Why don't you copy the PS module from 10 and put it on the 2012 server? Mar 7, 2016 at 23:04
  • @user5870571 I'm fairly sure it's not missing because they didn't include it in the PS module, but that the underlying functionality is not in 2012 R2
    – Sam Cogan
    Mar 8, 2016 at 11:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .