Posted On March 11, 2021

PowerShell: Dealing with Service Principle Names (SPNs)

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: Dealing with Service Principle Names (SPNs)

Basic Commands:

# Show SPNs
$computername="$env:computername"
Get-ADComputer -Identity $computername -Properties ServicePrincipalNames |Select-Object -ExpandProperty ServicePrincipalNames

# Add one SPN
Set-ADComputer @{Add="WSMAN/$computername"}

# Add multiple SPNs
Set-ADComputer -ServicePrincipalNames @{Add='WSMAN/Mycomputer',"WSMAN/$computername.$env:USERDNSDOMAIN"}

# Edit SPNs
Set-ADComputer -ServicePrincipalNames @{Add='WSMAN/Mycomputer'},@{Remove="WSMAN/$computername.$env:USERDNSDOMAIN"}

# Clear SPNs
# Set-ADComputer -ServicePrincipalNames $Null

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

PowerShell: How To Invoke Rest Method with RingCentral Rest API

[string]$restApiTokenUrl="https://platform.ringcentral.com/restapi/oauth/token" [string]$restApiUrl="https://platform.ringcentral.com/restapi/v1.0/account/~/extension?page=1" [string]$username='15555555555' [string]$password='PASSWORDHERE' [string]$extension='100' [string]$appKey='APPKEYHERE' # Part 1: Obtain Rest-API Token / Authorization function…

HTML: Basic Anatomy of A Page

Modern browsers discern the type of documents being loaded; thus, it is necessary to tag…

PowerShell: Add Windows NTFS Permissions to File or Folder

The re-usable function: $path='C:\Windows\servicing' $accountsToAdd='Administrators' $permissions='Full' function addNtfsPermissions ($path,$accountsToAdd,$permissions){ $acl = Get-ACL $path $accessRule=New-Object System.Security.AccessControl.FileSystemAccessRule($accountsToAdd,$permissions,"Allow")…