Skip to content

Instantly share code, notes, and snippets.

@jschell
Created August 15, 2025 22:13
Show Gist options
  • Select an option

  • Save jschell/56d77d3d003f4926f118ef1b022986d0 to your computer and use it in GitHub Desktop.

Select an option

Save jschell/56d77d3d003f4926f118ef1b022986d0 to your computer and use it in GitHub Desktop.
function New-KerberosTicketRequest
{
<#
.NOTES
#### Name: New-KerberosTicketRequest
#### Author: J Schell
#### Version: 0.1.0
#### License: MIT License
### Change Log
##### 2018-07-06::0.1.0
-initial creation
#>
[CmdletBinding()]
Param
(
[string]
$Server,
[string]
$SPN = 'host'
)
$target = "$($SPN)/$($Server)"
Try
{
$ticket = [System.IdentityModel.Tokens.KerberosRequestorSecurityToken]::new($target)
}
Catch
{
if( $($Error.Exception.InnerException.InnerException.InnerException) -like "*The specified target is unknown or unreachable")
{
Write-Error "The specified target is unknown or unreachable"
}
else
{
Write-Error $_
}
}
$ticket
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment