Skip to content

Vcert Playbook CAPI installation fails if run from PowerShell #641

Description

@madamorr

PROBLEM SUMMARY
When running a playbook on Windows and specifying CAPI as the installation, the certificate cannot be installed when run from Powershell( either 5.x or 7.x)
The same playbook run from the command prompt works as expected.
We utilize Powershell scripts to run our vcert playbooks.

STEPS TO REPRODUCE
Open Powershell pwsh

Issue the following command:
PS H:\vcerttesting\vcert.exe run -f .\CAPI_Playbook.yaml --debug

Playbook Yaml:
config:
connection:
platform: tpp
url: "https://mytppserver.com"
credentials:
accessToken: "*****************"
clientId: "myClientId"
certificateTasks:
-name: "CAPI Install"
renewBefore: 31d
setEnvVars: ["thumbprint"]
request:
csr: service
zone: "vcert\testing\my\space"
subject:
commonName: "myserver.example.com"
installations:
- format: CAPI
capiLocation: 'CueentUser\MY'
capiFriendlyName: "myserver.example.com"
capiIsNonExportable: True

EXPECTED RESULTS
I would have expected the operation to work when using PowerShell(pwsh) as it works with cmd(Command prompt)
I tried opening pwsh as an administrator and the same failure.

ACTUAL RESULTS
2026-04-29T13:23:07.032-500 ERROR vcert/playbook.go:151 error running task {"task": "CAPI Install", "error": "errot installing certificate at location CurrentUser\MY: failed to install certificate into CAPI,stdout: '': failed to run script function "install-cert": failed to run script file: Get-Item: Cannot find drive. A drive with the name 'Cert' does not exist.\r\n At C:\Users\User\AppData\Local\Temp\venafi-winrm-execiute-929cc939-ff4d-48b7-bc3c-62562d745c795.ps1:108 char:17\r\n $capi= Get-Item "Cert:\$($storeLocation)\$($installToStore)"\r\n
CategoryInfo : ObjectNotFound: (Cert:String) [Get-Item], DriveNotFoundException\r\n\r\n
You cannot call a method on a null-values expression.\r\n

ENVIRONMENT DETAILS
VCert: Version v5.12.2 and v5.12.3
Windows 11 Professional
Windows Server 2022 Standard

COMMENTS/WORKAROUNDS
No workarounds at the moment as I cannot run ps1 scripts from PowerShell

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions