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

发布于 2024-10-04 16:12:18 字数 187 浏览 9 评论 0原文

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

(在 Windows Serve 2003 和 Windows Serve 2008 中)

How do I get the ticket lifetime from the Active Directory Kerberos Policy? Basically, I need to access the values found here: Computer Configuration > Policy > Windows Settings > Security Settings > Account Policies > Kerberos Policy.

(in both Windows Serve 2003 and Windows Serve 2008)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瑾夏年华 2024-10-11 16:12:18

这可以使用 WMI 来完成。具体来说,在 .NET 中,您需要使用 WMI .NET。要查找您正在寻找的特定值,我建议您使用此工具:

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

这允许您浏览 CIMV2 根目录并使用查询进行 futz,直到确定正确无误,然后您只需将查询粘贴到 WMI.NET 代码中即可。

它看起来像这个

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

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

This can be done using WMI. Specifically in .NET you'll want to use WMI.NET. To find the specific value you're looking for I recommend that you use this tool:

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

This allows you to browse the CIMV2 root and futz with the query until you're sure you've got it correct, then you can just paste the query into your WMI.NET code.

It'll look something like this:

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

foreach (ManagementObject disk in searcher.Get()) 
{
  Console.WriteLine(disk.ToString());
}
彩虹直至黑白 2024-10-11 16:12:18

我认为这实际上是正确的查询(在 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

I think this is actually the correct query (in 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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文