kerberos

 $results = setspn -Q "MSSQLSvc/*" | Where-Object { $_ -match "^MSSQLSvc/" }


$parsed = $results | ForEach-Object {

    if ($_ -match "^(MSSQLSvc/.*?):\s*(CN=.*)$") {

        [PSCustomObject]@{

            SPN = $matches[1]

            Account = $matches[2]

        }

    } elseif ($_ -match "^(MSSQLSvc/.*)$") {

        [PSCustomObject]@{

            SPN = $matches[1]

            Account = ""

        }

    }

}


$parsed | Export-Csv -Path MSSQL_SPNS.csv -NoTypeInformation


Comments

Popular posts from this blog

Enhanced Query - To Update Account Status and Name

Connection Config - STATUS_THRESHOLD_CONFIG

Email variables _ Register User