Venafi / VenafiPS

Powershell module to fully automate your Venafi TLS Protect Datacenter and Cloud platforms!
https://venafips.readthedocs.io/
Apache License 2.0
18 stars 7 forks source link

Two issues with Set-VenafiStandaloneScript #292

Open Alex-Gomez-Lopez opened 1 month ago

Alex-Gomez-Lopez commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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.