如何從Active Directory Kerberos策略獲取票證使用期限?基本上,我需要訪問這裏找到的值:計算機配置>策略> Windows設置>安全設置>帳戶策略> Kerberos策略。如何使用.NET獲取AD Kerberos票證生存期?
(在Windows Serve 2003和Windows Serve 2008中)
如何從Active Directory Kerberos策略獲取票證使用期限?基本上,我需要訪問這裏找到的值:計算機配置>策略> Windows設置>安全設置>帳戶策略> Kerberos策略。如何使用.NET獲取AD Kerberos票證生存期?
(在Windows Serve 2003和Windows Serve 2008中)
這可以使用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());
}
我覺得這其實是正確的查詢(在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