I have created a new group managed service account in AD and added two servers to access the account. I am able to use the account in services.msc. It is accepting it there but when I am trying to schedule task in Task scheduler (using PowerShell command) I am getting error that user name or password is incorrect.
Register-ScheduledTask : The user name or password is incorrect. At line:4 char:1 + Register-ScheduledTask myAdminTask –Action $action –Trigger $trigger ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : AuthenticationError: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Register-ScheduledTask], CimException + FullyQualifiedErrorId : HRESULT 0x8007052e,Register-ScheduledTask
The command I am using is this:
$action = New-ScheduledTaskAction "C:\Users\admin\Desktop\backup.cmd" $trigger = New-ScheduledTaskTrigger -At 23:00 -Daily $principal = New-ScheduledTaskPrincipal -UserID abc\gmsa$ -LogonType Password Register-ScheduledTask myAdminTask –Action $action –Trigger $trigger –Principal $principal
I am using the right syntax for username (domainname\serviceaccount$).
FYI : I am testing this on win server 2016 on azure cloud.
Found the solution for the problem. Only thing that needs to be done after added the computer in a security group which access group managed service account is to reboot the server once to reflect membership changes. After reboot I was able to add the account using powershell.
P.S :- Thanks for your reply postanote, I really appreciate it. :)
User contributions licensed under CC BY-SA 3.0