-
-
Save DiHo78/fe9d6f331536064ba7d7ede6fb5c564b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SPN SETZEN DB Service | |
$MeinServiceKto = "MyServiceAccount" | |
#Variablen fuer Alias, Environment, Dienst | |
$AliasApp = "MyApp" | |
$TargetEnv = "P" | |
$Svc = "MSSQLSvc" | |
$domain = 'domain.local' | |
$MeinServiceKonto = $MeinServiceKto + $TargetEnv | |
$MeinServiceKonto | |
$DBSPNs2Add = @() | |
$DBSPNs2Add += $svc+ '/SQL-'+$AliasApp+'-DB-'+$Targetenv+'.'+$domain+':1433' #still a bit static | |
$DBSPNs2Add += $svc+ '/SQL-'+$AliasApp+'-DB-'+$Targetenv+'.'+$domain #still a bit static | |
$DBSPNs2Add | |
$mySvcAcc = Get-ADServiceAccount -Identity $MeinServiceKonto | |
$mySvcAcc.DistinguishedName | |
#SPN hinzufügen | |
Set-ADObject -Identity $mySvcAcc -Add @{"ServicePrincipalName"=$DBSPNs2Add} -Verbose -WhatIf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment