我尝试在运行 Server 2012 的计算机上在 Powershell 中运行以下命令:
makecert -r -pe -n CN="*.$domainVariable" -b 01/01/2000 -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localmachine
我收到错误:
makecert : The term 'makecert' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ makecert -r -pe -n CN="*.$domainVariable" -b 01/01/2000 -e 01/01/2036 -eku 1.3.6 ...
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (makecert:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
因此我在网上做了一些研究之后运行了这个命令:
set-location 'C:\Program Files\QACloneAutomation' makecert -r -pe -n CN="*.$domainVariable" -b 01/01/2000 -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localmachine
现在我收到此错误:
Set-Location : Parameter cannot be processed because the parameter name 'e' is ambiguous. Possible matches include:
-ErrorAction -ErrorVariable.
At C:\Users\Administrator\Desktop\cloneSetup.ps1:48 char:107
+ ... -b 01/01/2000 -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localmachine
+ ~~
+ CategoryInfo : InvalidArgument: (:) [Set-Location], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameter,Microsoft.PowerShell.Commands.SetLocationCommand
我想知道是否有人知道该问题的解决方案。我看到大约 8 年前有人向 Microsoft Connect 提交了一张针对同一问题的票据(票据编号 183738),但我无法访问 Connect 来查看结果。
答案1
当涉及到 Powershell 时,您确实需要提供非 powershell 命令的全名。因此makecert
,您应该使用而不是makecert.exe
。