如何使用.NET获取AD Kerberos票证生命周期?

时间:2010-11-24 09:09:52

标签: .net kerberos windows-server

如何从Active Directory Kerberos策略获取票证生命周期?基本上,我需要访问此处找到的值:计算机配置>政策> Windows设置>安全设置>帐户政策> Kerberos政策

(在Windows Serve 2003和Windows Serve 2008中)

2 个答案:

答案 0 :(得分:0)

这可以使用WMI完成。特别是在.NET中,您需要使用WMI.NET。要找到您要查找的具体值,我建议您使用此工具:

http://thepowershellguy.com/blogs/posh/archive/2007/03/22/powershell-wmi-explorer-part-1.aspx

这允许您使用查询浏览CIMV2根和futz,直到您确定它已正确为止,然后您可以将查询粘贴到您的WMI.NET代码中。

它看起来像this

WqlObjectQuery wqlQuery = new WqlObjectQuery("SELECT * FROM Win32_LogicalDisk");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(wqlQuery);

foreach (ManagementObject disk in searcher.Get()) 
{
  Console.WriteLine(disk.ToString());
}

答案 1 :(得分:0)

我认为这实际上是正确的查询(在VB.NET中):

http://www.activexperts.com/activmonitor/windowsmanagement/scripts/grouppolicy/

strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:\\" & strComputer & "\root\rsop\computer")

Set colItems = objWMIService.ExecQuery _
    ("Select * from RSOP_SecuritySettingBoolean")

For Each objItem in colItems
    Wscript.Echo "Key Name: " & objItem.KeyName
    Wscript.Echo "Precedence: " & objItem.Precedence
    Wscript.Echo "Setting: " & objItem.Setting
    Wscript.Echo
Next