从C#签署PowerShell脚本 [英] Sign PowerShell script from C#

查看:73
本文介绍了从C#签署PowerShell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个Web服务来签署Powershell脚本以供在Intranet中使用。是否可以在set-authenticodesignature创建的脚本的末尾复制编码的文本块?

I'm looking to create a web service to sign powershell scripts for use within an intranet. Is it possible to replicate the block of encoded text at the end of a script that set-authenticodesignature creates?

MSDN文档
似乎没有。

The MSDN documentation seems to say no.

推荐答案

.NET不是您的朋友。我无法找到支持-我已经多次搜索

.NET is not your friend on this one. No support that I've been able to find - I've searched on multiple occasions


  1. 这是一个VB示例, Win32 API。可以适应Powershell。 http://blogs.msdn.com/b/alejacma/archive/2008/02/20/how-to-sign-exe-files-with-an-authenticode-certificate-vb-net .aspx

博客提到CAPICOM.SignedCode。如果您已经安装了CAPICOM,或者可以选择这样做,那我就选择了。我个人更喜欢使用COM而不是PS上的Win32。

The blog mentions CAPICOM.SignedCode. If you already have CAPICOM installed or that is an option, I'd go with that. I personally prefer using COM over Win32 from PS.

怀疑您不想这样做,但是FWIW,Mono确实支持内置的Authenticode签名。 。不久前,我能够剪切,粘贴和编辑Mono C#代码的一大块,并将其在Powershell上运行。

Suspect you don't want to do this, but FWIW, Mono does have support for Authenticode signing built in. I was able to cut, paste, and edit a big blob of Mono C# code a while back and get it to work on Powershell.

这篇关于从C#签署PowerShell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆