Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Principal not taken into account in Register-ScheduledTask in Grani_ScheduleTask.psm1 #70

Open
Imroath opened this issue May 17, 2017 · 3 comments
Assignees

Comments

@Imroath
Copy link

Imroath commented May 17, 2017

Hi,
According to Technet there are 4 possible set of parameters in Register-ScheduledTask: User, Object, Principal and xml (link: https://technet.microsoft.com/en-us/library/jj649811(v=wps.630).aspx)

In function GetRegisterParam you are creating a Principal and trying to pass it to Register-ScheduledTask using an Object parameter set. This does not work, Principal parameter in your call is omitted!

You need to call Register-ScheduledTask with Principal parameter set to make it work correctly, like:
return @{
TaskName = $TaskName
TaskPath = $TaskPath
Action = $scheduleTaskParam.action
Trigger = $scheduleTaskParam.trigger
Settings = $scheduleTaskParam.settings
Principal = $scheduleTaskParam.principal
Description = $scheduleTaskParam.description
}

I discovered this because I needed my task to run in interactive mode, so with LogOnType = "Interactive".
Can you please add also a paraameter that will allow to specify the LogOnType?

@guitarrapc guitarrapc self-assigned this May 26, 2017
@guitarrapc
Copy link
Owner

Yes, you are right, indeed I omitted it because I don't use it on my production lol.
Let me check and will add it for you.

@Imroath
Copy link
Author

Imroath commented May 29, 2017

I have to admit that your resource was so far the best I have seen. If you could add "LogOnType" as a parameter it would allow me to use the official version instead of my own hacked copy. LogOnType is one of the options on first task tab so I am sure that it will be not only me who will want to use it:)

@guitarrapc
Copy link
Owner

Could you give me an example of your Configuration sample to execute with the principal? I do want to check with unit test for logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants