ComputerManagementDsc icon indicating copy to clipboard operation
ComputerManagementDsc copied to clipboard

ScheduleTask doesn't work properly with domain credentials

Open popovmindbox opened this issue 6 years ago • 4 comments

If you use domain credentials with login like domain\username or username@domain, Test-DSCConfiguration will say that this resources not in desired state, because, as I understand, $task.Principal.UserId which is used in Get-DSCConfiguration give you only username, without any domain specification.

popovmindbox avatar Dec 28 '18 14:12 popovmindbox

Thank you for reporting this @popovmindbox . This should be an easy enough fix.

PlagueHO avatar Dec 28 '18 20:12 PlagueHO

Just chiming in as a +1 that I ran into this issue in my usage as well. Inputting the username without the domain syntax works, however if someone wanted to use a domain credential for a different trusted domain then they might run into issues.

ShawnHardwick avatar Sep 30 '19 14:09 ShawnHardwick

Thanks @ShawnHardwick - this should be a relatively easy fix - good for hacktoberfest :grin:

PlagueHO avatar Oct 01 '19 07:10 PlagueHO

This is also one of those lovely differences in behavior between 2012 (R2) and 2016. Testing on my environment:

W2012R2 returns: DOMAIN\UserId W2016 returns: UserId

So this is tricky to fix, since W2016 doesn't return the domain. Unfortunately, I don't have a trusted forest to test with, I'm wondering how the different versions would return that.

Edit: Both operating systems are returning the same class though: Microsoft.Management.Infrastructure.CimInstance#root/microsoft/windows/taskscheduler/MSFT_TaskPrincipal2

danielboth avatar Oct 14 '19 20:10 danielboth