Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-TPPCertificate function throws error 'Cannot find an overload for "Add" and argument count: 3' at line 287 when -CSR argument is used #111

Closed
MichalZyzakCS opened this issue May 9, 2022 · 0 comments · Fixed by #112
Assignees
Labels
bug Something isn't working

Comments

@MichalZyzakCS
Copy link

Hello.
I created a CSR and put it into $CSR variable
I run command New-TppCertificate -Path $CertPath -Name $PCName -CSR $CSR.
I got error that script cannot perform some Add action on $params.body object because of wrong parameter count.

I have created own version of New-TppCertificate function where line 287 is changed to:
$param.body.Add('PCKS10', $csr -replace "n|r") <-- notice 2 parameters, not 3
and it worked

Environment

Test

Operating System: Windows 10 20H2
VenafiPS version: 4.2.4
PowerShell version: 5.1

Steps to reproduce

Import-Module VenafiPS
$Server = "https://test-server-domain.net"
$YID = Get-Credential -Credential "TestAccount"
$CSR = [string](Get-Content -path C:\test\csr.csr)
New-VenafiSession -Server $Server -Verbose -Credential $YID
$PCName = $env:computername
$PCFQDN = ($PCName,$env:USERDNSDOMAIN) -join('.')
$PCType = "Desktops"
$CertPath = "\VED\Policy\Certs\v1\$PCType"
$CAPath = "\VED\Policy\Administration\CAs\TestTempalte1"
New-TppCertificate -Path $CertPath -Name $PCName -CSR $CSR

Expected behavior

Certificate should be created

Actual behavior

Cannot find an overload for "Add" and argument count: 3.
At C:\Program Files\WindowsPowerShell\Modules\VenafiPS\4.2.4\Public\New-TPPCcertificate.ps1:287 char:13

Screenshots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants