# 1 Jahr SAN
New-SelfSignedCertificate -DnsName www.ndsedv.de, www.nds-edv.de, www.der-windows-papst.de -CertStoreLocation cert:\LocalMachine\My
# 3 Jahre SAN
$heute = Get-Date
$3years = $heute.AddYears(3)
New-SelfSignedCertificate -DnsName www.ndsedv.de, www.nds-edv.de -notafter $3years -CertStoreLocation cert:\LocalMachine\My
# Zugriff Zertifikatsspeicher
Get-ChildItem -Path Cert:\LocalMachine\My\
# Zertifikat exportieren (Privat)
$Password = ConvertTo-SecureString -String “TEST” -Force –AsPlainText
Export-PfxCertificate -Cert cert:\LocalMachine\My\ABF6BE65FFAC0002DE8BAF994D965C6E8C7EF520 -FilePath C:\Certs\NDS.pfx -Password $Password
# Zertifikat exportieren (Öffentlich)
Export-Certificate -Cert Cert:\LocalMachine\My\ABF6BE65FFAC0002DE8BAF994D965C6E8C7EF520 -FilePath C:\Certs\NDS.cer
# Code Signing Zertifikat für Powershell Skripte
$cert = New-SelfSignedCertificate -Subject “Code Signing” -Type CodeSigningCert -CertStoreLocation cert:\LocalMachine\My
Set-AuthenticodeSignature -FilePath “C:\Certs\Create Self Signed SAN Certificate2.ps1” -Certificate $cert
# 3 Jahre SAN mit Schlüssellänge von 4096 Bit
$heute = Get-Date
$3years = $heute.AddYears(3)
$cert = New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -DnsName www.ndsedv.de, www.nds-edv.de -notafter $3years -KeyLength 4096