As it is not possible to use GUI for creating a scheduled task on Windows when using gMSA I must user Powershell.
What I have done is : creating my task using GUI whith administrator account then I have changed the user using this command
[pre]$principal = New-ScheduledTaskPrincipal -UserID Domain\GMServiceAccount$ -LogonType Password
Set-ScheduledTask “Task Name” -Principal $principal[/pre]
It works fine for 1 server but I need to use it to multiple servers.
Si I have exported my task by GUI and imported it using this PS command :
[pre]Register-ScheduledTask -xml (Get-Content ‘C:\PATH\TO\IMPORTED-FOLDER-PATH\TASK-INPORT-NAME.xml’ | Out-String) -TaskName “TASK-IMPORT-NAME” -User Domain\GMServiceAccount$ –Force[/pre]
My issue appeared at this time because after importing my task on another server some parameters have changed.
My task has been created to run “whether user is logged on or not” but after the importation this parameters changes to “Run only when user is logged on”.
Do you have any idea about what I can do ?