4

我需要能够从组织中的每台 PC 中删除特定证书。是的,我可以逐座进行,但我要到星期四才能完成,而且我没有人力来逐座进行。

是否有使用 C# 的编程方式来执行此操作?

4

2 回答 2

3

我认为您不需要编写任何 C# - 看看certmgr.exe /del.

如果你今天真的想写一些 C# 来做到这一点,那么看看X509Store.Remove.

于 2009-03-16T21:32:07.690 回答
3

MSDN中有一个例子(点击这里

我认为这个例子是不言自明的,但摘录如下:

using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.IO;

public class X509store2
{
    public static void Main (string[] args)
    {
        //Create new X509 store called teststore from the local certificate store.
        X509Store store = new X509Store ("ROOT", StoreLocation.CurrentUser);
        store.Open (OpenFlags.ReadWrite);

        ...

        store.Remove (certificate1);
        store.RemoveRange (collection);

        ...

        //Close the store.
        store.Close ();
    }    
}
于 2009-03-16T22:30:23.197 回答