This commit is contained in:
Zack Meier
2026-04-15 15:42:41 -05:00
parent 74edcc4d9a
commit 03dba08135
146 changed files with 9119 additions and 1 deletions
+25
View File
@@ -0,0 +1,25 @@
$func = {
#Add to Local Security Policy
function Add-ServiceLogonRight([string] $Username) {
Write-Host "Enable ServiceLogonRight for $Username"
$tmp = New-TemporaryFile
secedit /export /cfg "$tmp.inf" | Out-Null
(Get-Content -Encoding ascii "$tmp.inf") -replace '^SeServiceLogonRight .+', "`$0,$Username" | sc -Encoding ascii "$tmp.inf"
secedit /import /cfg "$tmp.inf" /db "$tmp.sdb" | Out-Null
secedit /configure /db "$tmp.sdb" /cfg "$tmp.inf" | Out-Null
Remove-Item $tmp* -ea 0
}
Add-ServiceLogonRight -Username svccohesityadm
# Set Service to Run as Service Account
Stop-Service -Name CohesityAgent
sc.exe config "CohesityAgent" obj="NDGOV\svccohesityadm" password="memo-fUpHMMgXnv"
Start-Service -Name CohesityAgent
# Add to Local Administrators group
Add-LocalGroupMember -Group Administrators -Member "ndgov\svccohesityadm"
}
Invoke-Command -ComputerName itddhssql19p1.nd.gov -Credential $PrvCred -ScriptBlock $func