# request模板
$requestInf= @'
;----------------- request.inf -----------------

[Version] 
Signature="$Windows NT$"

[NewRequest] 
;Change to your,country code, company name and common name 
Subject = "C=CN, O=Mosser Lee, CN=www.pstips.net"

KeySpec = 1 
KeyLength = 2048 
Exportable = TRUE 
MachineKeySet = TRUE 
SMIME = False 
PrivateKeyArchive = FALSE 
UserProtected = FALSE 
UseExistingKeySet = FALSE 
ProviderName = "Microsoft RSA SChannel Cryptographic Provider" 
ProviderType = 12 
RequestType = PKCS10 
KeyUsage = 0xa0

[EnhancedKeyUsageExtension] 
OID=1.3.6.1.5.5.7.3.1 ; this is for Server Authentication / Token Signing 
;-----------------------------------------------
'@

#输出模板到文件
$requestInfFile =  'request.inf'
$requestCSRFile = 'request.csr'
$requestInf | Out-File $requestInfFile

#创建证书
certreq -new $requestInfFile $requestCSRFile

#打印证书路径
$requestCSRFile = (Get-Item $requestCSRFile).FullName
Write-Host "CSR文件已保存到 $requestCSRFile"
×用微信扫描并分享

关于 Mooser Lee

我是一个Powershell的爱好者,创建了PowerShell中文博客,热衷于Powershell技术的搜集和分享。本站部分内容来源于互联网,不足之处敬请谅解,并欢迎您批评指正。