Purpose
PowerShell script that will allow you to verify if a SPN (Service Principal name) exists in the domain that allows you to generate a TGS (Ticket Granting Service) ticket. This script searches Active Directory for registered SPNs and displays those that meet the criteria.
There are different search queries to use, I recommend these
StepsQuery 1:
* This means that this account has a registered Service Principal Name (SPN) for SQL Server.
* MSSQLSvc indicates the service (SQL Server).
* NETVXX.domain.com is the hostname where the service runs.
:* 1433 is the standard TCP port for SQL Server. ➝ In other words: the Administrator account is associated as a service identity for a SQL Server on that server/port. This allows clients to use Kerberos authentication to connect to that SQL instance.
Query 2:
Import-Module ActiveDirectory
# Definir el SPN que deseas
$spn = "HTTP/*"
# Buscar cuentas de servicio
$cuentasConSPN = Get-ADObject
# Verificar si se encontraron
if ($cuentasConSPN) {
Write-Output "Se
$cuentasConSPN | Select-
} else {
Write-Output "No se
}
ADVICE1: If you can not remove the SPN feature, it is recommended to put one password 25 long or more
ADVICE2: You can create a script that checks if there are any changes in the output of these queries.
By GoN | Published: Jun 2025 | Last Updated.Dec 2025:

No hay comentarios:
Publicar un comentario