Skip to content

Commit

Permalink
Create Get-DomainKerberosPolicy
Browse files Browse the repository at this point in the history
This script reads the domain Kerberos policy from Group Policy.
NOTE: This script REQUIRES the GroupPolicy module installed.
  • Loading branch information
PyroTek3 committed Mar 9, 2015
1 parent 157acb4 commit 022098c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Get-DomainKerberosPolicy
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
}

0 comments on commit 022098c

Please sign in to comment.