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

Two issues with Set-VenafiStandaloneScript #292

Closed
Alex-Gomez-Lopez opened this issue Aug 13, 2024 · 4 comments · Fixed by #293
Closed

Two issues with Set-VenafiStandaloneScript #292

Alex-Gomez-Lopez opened this issue Aug 13, 2024 · 4 comments · Fixed by #293
Assignees

Comments

@Alex-Gomez-Lopez
Copy link

Alex-Gomez-Lopez commented Aug 13, 2024

After using Set-VenafiStandaloneScript to generate a VenafiPS v6.4.0-based standalone PowerShell script I have encountered these two errors:

1- "Executable script code found in signature block", one per signature block in my code.
2- "Exception "System.Management.Automation.RuntimeException: Unable to find type [TppManagementType].", this one is raised when processing the ManagementType parameter in function Find-VdcCertificate.

I am not sure if these errors are caused by a bug or else there is something I am missing, thanks in advance!! Version of PowerShell is 5.1 running on Windows Server 2019 Datacenter build 17763.2061.

@wilddev65
Copy link
Collaborator

This is because that script just copies each function into your script including the signature of the function. You have to remove the signatures and make sure that the functions are in the correct place in the script before it will run.

@gdbarron
Copy link
Collaborator

Thanks @Alex-Gomez-Lopez for reporting this. I recently came across the first error and you beat me to creating an issue for it. This is due to us signing the module beginning in 6.0 and including that in the updated script.

As a workaround, remove the signature(s) for error 1. For the second error, that enum should have been added to the script. Perhaps it is lower in the script. I'll look into it.

@gdbarron gdbarron self-assigned this Aug 13, 2024
@gdbarron
Copy link
Collaborator

This is because that script just copies each function into your script including the signature of the function. You have to remove the signatures and make sure that the functions are in the correct place in the script before it will run.

It actually includes the sigs from the enums and classes, not functions.

@gdbarron
Copy link
Collaborator

gdbarron commented Oct 1, 2024

This issue has been fixed and will be merged, but is no longer needed beginning with 6.5.0. The release now includes all functions merged into 1 psm1 and then signed. This new psm1 can be delivered side by side with the script and add import-module <path to psm1> -force; it will work as expected. Continue to use Set-VenafiStandaloneScript if working with a version prior to 6.5.0. The release now includes the psd1 and psm1 as well for ease of access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants