Good Morning,
I am very new to Powershell and scripting in general. I thought I would try to make a small script to invoke the New-SelfsignedCertificate Cmdlet on a remote server or servers. (The makecert tool gets a little tedious when you have to use it often.) Here is my script.
Param ( [Parameter(Mandatory=$True)] [string]$computername, [Parameter(Mandatory=$True)] [string]$CertStoreLocation, [Parameter(Mandatory=$True)] [string]$dnsname ) $Params = @{ "CertStoreLocation"=$CertStoreLocation "DNSname"=$dnsname } Invoke-command $computername New-SelfSignedCertificate @Params
So when I run the script locally with the invoke-command cmdlet commented out, I can give the certstorelocation parameter “cert:\localmachine\my” and it works beautifully.
When I try to invoke on a remote computer I get.
Invoke-Command : A parameter cannot be found that matches parameter name ‘CertStoreLocation’.
At C:\Users\jason.garner\Google Drive\Scripts\GenerateSSL.ps1:18 char:56
- Invoke-command $computername New-SelfSignedCertificate @Params
-
~~~~~~~
- CategoryInfo : InvalidArgument: ( [Invoke-Command], ParameterBindingExcepti
on - FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeCom
mandCommand
- CategoryInfo : InvalidArgument: ( [Invoke-Command], ParameterBindingExcepti
I figure its probably something dumb that I am not getting.
Thank you for your time.