Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Update Scheduled Tasks:

    • Modify all gytpolServer scheduled tasks (3 in total) to run under the gMSA:

      1. Set the task to use the gMSA username (gytgmsa$) with an empty password.

        image-20250117-160308.png
  2. 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
languagepowershell
# 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"
}