I was trying to use the method New-SelfSignedCertificate
. Let say that I’ve used the example call from here: https://learn.microsoft.com/en-us/powershell/module/pki/new-selfsignedcertificate?view=windowsserver2022-ps
$params = @{
Type = 'Custom'
Subject = '[email protected],CN=Patti Fuller'
TextExtension = @(
'2.5.29.37={text}1.3.6.1.5.5.7.3.4',
'2.5.29.17={text}[email protected]&[email protected]' )
KeyAlgorithm = 'RSA'
KeyLength = 2048
SmimeCapabilities = $true
CertStoreLocation = 'Cert:CurrentUserMy'
}
New-SelfSignedCertificate @params
First I’ve got this error:
New-SelfSignedCertificate : Parameter cannot be processed because the parameter name 'Subject' is ambiguous. Possible
matches include: -SubjectName -SubjectAlternative.
And I’ve changed Subject to SubjectName resulting:
New-SelfSignedCertificate : Cannot validate argument on parameter 'SubjectName'. The argument "[email protected],CN=Patti Fuller"
does not match the "^(CN|E|O|OU|C|ST|L):[^,:]+$" pattern. Supply an argument that matches "^(CN|E|O|OU|C|ST|L):[^,:]+$"
and try the command again.
Which actually matching the pattern. I’ve run similar command also few days ago and it worked correctly. I am using Windows 11