I suggest you try using the parameter "-TaskCredentials $null" to use the preconfigured RunAs account.
Example:
Start-SCOMTask -Task $TaskObject -Instance $AgentObject -ErrorAction Continue -TaskCredentials $null
I hope it helps.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello folks,
I want to use the predefined Run As Account option in my SCOM tasks, but right now I feel like it's not possible from PowerShell.
There was a change in SCOM 2022 that right now -taskcredentials is required in the Start-SCOMTask command.
Settings > Miscellaneous > Tasks Execution, is enabled.
I think there is an option to achieve this by editing the task directly in the management package, but I would like to achieve this without interfering there.
Do you have any advice?
I suggest you try using the parameter "-TaskCredentials $null" to use the preconfigured RunAs account.
Example:
Start-SCOMTask -Task $TaskObject -Instance $AgentObject -ErrorAction Continue -TaskCredentials $null
I hope it helps.
Hi,
Start-SCOMTask does not require the usage of PSCredential when started by non-admin users and when the option "Task Execution" is Disabled. In this case (when -TaskCrendetials). This would result in the task failing in case the non-admin user has not been delegated the permission on the task in question.
In order to better understand your gooal I have to ask some additional questions:
Get-SCOMTask -DisplayName "Get Monitor State" | Start-SCOMTask -Instance $Instances
with the option "Task Execution" (Reference) being disabled?
Can you please post those detials, I will do my best to help you.
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Stoyan Chalakov
Hi Patryk,
why don't you jsut disable this option?
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Stoyan Chalakov