forked from PyroTek3/PowerShell-AD-Recon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Get-DomainKerberosPolicy
17 lines (14 loc) · 989 Bytes
/
Get-DomainKerberosPolicy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Function Get-KerberosPolicy
{
# NOTE: This script REQUIRES the GroupPolicy module installed.
Import-Module GroupPolicy
[string]$PDCHostName = (Get-ADDomainController -Discover -Service PrimaryDC).HostName
[xml]$DefaultDomainPolicyXML = Get-GPO -Name "Default Domain Policy" -Server $PDCHostName | Get-GPOReport -ReportType XML # -Path c:\temp\DDP.xml
$NameSpaceManager = New-Object System.XML.XmlNamespaceManager($DefaultDomainPolicyXML.NameTable)
$NameSpaceManager.AddNamespace('root','http://www.microsoft.com/GroupPolicy/Settings')
$GPOsettings = [array]$DefaultDomainPolicyXML.SelectNodes('//root:Extension',$NameSpaceManager)
$KerberosPolicySettings = $GPOsettings.Account |?{$_.type -match "Kerberos"}
$KerberosPolicySettingsMaxRenewAge = $KerberosPolicySettings.MaxRenewAge
$KerberosPolicySettingsMaxTicketAge = $KerberosPolicySettings.MaxTicketAge
return $KerberosPolicySettings
}