Closed rutemja closed 3 years ago
Did you find a workaround to your issue? If so, will you share it so others can benefit?
Sure. The trick is to instantiate the TaskService with the admin user (that has a password) and then call RegisterTaskDefinition
with the user that has no password.
Solution in VB.NET (Sorry! :D):
Using scheduler = New TaskService(Nothing, adminUserName, domain, adminPassword)
Dim definition = scheduler.NewTask()
' Change the definition
scheduler.RootFolder.RegisterTaskDefinition("TestTask", definition, TaskCreation.Create, $"{domain}\\UserThatHasNoPassword", Nothing, TaskLogonType.InteractiveToken)
End Using
Is your feature request related to a problem? Please describe. In my special case I have a lot of legacy PCs that are using a Windows user that has no password. When I try to create a task for this user I always get a
System.ArgumentException: A username, password, and domain must be provided
.Describe the solution you'd like It should be possible to create a task for a user that has no password.
Describe alternatives you've considered I tried
null
andString.Empty
as password.