Created
March 29, 2019 17:23
-
-
Save neKuehn/bad7b9cb2edef50498add167f5e3f8d4 to your computer and use it in GitHub Desktop.
Removes the SPNs created when using the DC Shadow functionality of mimikatz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -RunAsAdministrator | |
#search for accounts that have the sync SPN that aren't a Domain Controller | |
$shadowcomps = Get-ADObject -LDAPFilter '(&(ServicePrincipalName=E3514235-4B06-11D1-AB04-00C04FC2DCD2/*)(!(userAccountControl:1.2.840.113556.1.4.803:=8192)))' -Properties ServicePrincipalName | |
foreach ($scomp in $shadowcomps){ | |
$sSpns = $scomp.ServicePrincipalName | where {$_ -like "E3514235-4B06-11D1-AB04-00C04FC2DCD2/*"} | |
foreach ($sSpn in $sSpns){ | |
setspn -d $sSpn $scomp.Name | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment