CFo*_*CFo 3 vbscript powershell sign wsh visual-studio-code
在我们的环境中,我们使用的两种主要脚本语言是 VBScript/WScript 和 PowerShell。我们的 PowerShell 设置为所有脚本都必须经过数字签名。在 PowerShell ISE 内部,我们添加了一个菜单项,用于保存当前工作脚本并对其进行数字签名。目前,我们对 VBS/Wscript 使用不同的编辑器。VSCode 中有没有办法允许我们在环境中运行一个函数来对当前的 PowerShell 脚本进行数字签名?
找到了我的答案:
Register-EditorCommand -Name SignCurrentScript -DisplayName 'Sign Current Script' -ScriptBlock {
    $cert = (Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert)[0]
    $currentFile = $psEditor.GetEditorContext().CurrentFile.Path
    Set-AuthenticodeSignature -Certificate $cert -FilePath $currentFile
}
| 归档时间: | 
 | 
| 查看次数: | 3387 次 | 
| 最近记录: |