如何在 XlRelease 中的 powershell 脚本中传递发布变量

问题描述 投票:0回答:1

我正在尝试自动为 IIS 生成证书。为了实现此目的,我使用 PowerShell 命令将 Base64 私钥转换为 PFX 格式并下载。由于此过程是自动化的,因此我需要将私钥作为 XL Release 中的发布变量传递。然而,我在实现这一目标时遇到了困难。

我试过了,但没用:

>powershell -command "$certificateBase64 = $using:releaseVariables['Certificate64Base']; $decodedPrivateKey = [System.Convert]::FromBase64String($certificateBase64); $privateKeyFilePath = 'C:\test_private_key.pfx'; [System.IO.File]::WriteAllBytes($privateKeyFilePath, $decodedPrivateKey)"

快速更新我尝试过这个:

powershell -command "$certificateBase64 = '${Certificate64Base}'; $decodedPrivateKey = [System.Convert]::FromBase64String($certificateBase64); $privateKeyFilePath = 'C:\test_private_key.pfx'; [System.IO.File]::WriteAllBytes($privateKeyFilePath, $decodedPrivateKey)"

但是我得到了:

任务无法启动,因为无法替换以下变量:${Certificate64Base}。确保定义了全局变量和文件夹变量,没有循环引用,密码变量仅在密码字段中使用,其他变量仅在非密码字段中使用。

windows powershell automation smb xlrelease
1个回答
0
投票

为什么不使用 jython 脚本? 你必须使用java bouncy castle,因为jython实现不能使用python crypto模块。 我已经制作了一个 XLRelease 模板来生成 CSR 并将其发布到 CEP/CES SOAP Web 服务(Windows PKI)。 示例:https://hengzhuliulin.wordpress.com/2013/08/09/create-pkcs12-from-pem-private-key-file-and-pkcs7-certificate-in-java/

拉希德

© www.soinside.com 2019 - 2024. All rights reserved.