...
Update Scheduled Tasks:
Modify all gytpolServer scheduled tasks (3 in total) to run under the gMSA:
Set the task to use the gMSA username (
gytgmsa$
) with an empty password.
Execute the tasks manually:
Right click and run all three tasks.
Monitor the tasks to ensure they are running without failures.
Script example:
Code Block | ||
---|---|---|
| ||
# Define the gMSA Name (Hardcoded)
$gMSAName = "gytgMSA$" # Include the $ suffix for the gMSA
# Set the Run Level
$runLevel = "Highest" # Options: Highest, Limited, etc.
# Array of Task Names
$taskNames = @("gytpolServer", "gytpolServerDaily", "gytpolServerWeekly")
# Loop through each task and update the principal
foreach ($taskName in $taskNames) {
# Create the Scheduled Task Principal
$principal = New-ScheduledTaskPrincipal -UserID $gMSAName -LogonType Password -RunLevel $runLevel
# Update the Scheduled Task with the new Principal
Set-ScheduledTask -TaskName $taskName -Principal $principal
Write-Host "Updated task: $taskName with gMSA: $gMSAName"
}
|