Error on "-e" parameter when running makecert command in powershell

0

I am trying to run the following command in Powershell on a machine running Server 2012:

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

I am getting the error:

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

So I ran this command after doing some research online:

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

Now I am getting this error:

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

I am wondering if anyone knows of a resolution to this issue. I saw one person submitted a ticket to Microsoft Connect about 8 years ago for the same issue (ticket # 183738), but I wasn't able to access Connect to find out what the result was.

JennaTime

Posted 2014-09-10T19:03:33.857

Reputation: 11

Are you sure you actually have a utility named makecert? Also, why are you trying to precede makecert with Set-Location? That really doesn't make much sense. – Zoredache – 2014-09-10T19:32:50.503

I have the makecert.exe file in the folder I'm trying to execute it from. Is there something else I need to get it going? – JennaTime – 2014-09-10T19:34:50.900

That worked! Thank you! I changed my command to this: .\makecert.exe -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 – JennaTime – 2014-09-10T19:38:35.493

Ok, I have added that as an answer. – Zoredache – 2014-09-10T19:40:21.987

Answers

0

When it comes to Powershell you really need to give the full name of your non-powershell commands. So instead of makecert, you should use makecert.exe.

Zoredache

Posted 2014-09-10T19:03:33.857

Reputation: 18 453