Scheduled Jobs: Cannot Define RunAs Acct

Upgraded to 2.1.2 last night and went to add a new schedule, but I’m unable to define the Run As account. Script is not set to use the Integrated environment, but when I add or edit a schedule there is no Run As section anymore. I can probably still modify the schedules.ps1 file, but anyone else experiencing this? I checked the GitHub issues page and didn’t see anything specific to the credential/RunAs scenario.


Edit: I was able to modify the schedules.ps1 file to define the Run As, but interested to know if this is expected or not.

Product: PowerShell Universal
Version: 2.1.2

Do you have a Run As account set on the script itself? This would prevent it from being set on the schedule (but apparently only in the UI :wink: )

Yes I do. I did try setting the Run As to default/blank but I still wasn’t seeing the option in the schedules. As long as it actually uses the Run As account defined, then I’m good. I was just thrown because in previous versions the schedule would show my various Run As accounts. If “default” now means the default you’ve defined for the script, then good to know!

Hi adam,

I’m working with version 2.5.3, I have configured RunAs accounts for some scripts and when scheduling them it’s not working. When I’m running them manually I can see they’re invoked as the configured RunAs account and for the schedules they’re missing. When I edit the schedules.ps1 manually and add the -Credential option, the schedules are working. Is there some bug or am I missing something?

Best regards,

It sounds like a bug. When you configure the schedules through the UI the -Credential option is not set?

Hi adam,

thanks for your quick reply. Yes, -Credential option has to be set manually in schedules.ps1. Should this be set automatically when a script has a conigured RunAs account or should the invokation of the script happen under the RunAs account automatically when creating a schedule for the script in the GUI? Maybe some screenshots:


New-PSUScript -Name "Test.ps1" -Path "Test\Test.ps1" -ErrorAction "Stop" -InformationAction "Continue" -MaxHistory 30 -Credential "svc_" 
New-PSUScript -Name "Test2.ps1" -Path "Test\Test2.ps1" -ErrorAction "Stop" -InformationAction "Continue" -MaxHistory 30 -Credential "svc_2" 
New-PSUScript -Name "Test3.ps1" -Path "Test3.ps1" -ErrorAction "Stop" -InformationAction "Continue" -MaxHistory 12 


New-PSUSchedule -Cron "0 23 * * 1-5" -Script "Test\Test.ps1" -TimeZone "Europe/Vienna" -Credential "svc_" #Manually added -Credential
New-PSUSchedule -Cron "0 6 * * 1-5" -Script "Test\Test2.ps1" -TimeZone "Europe/Vienna" -Credential "svc_2" #Manually added -Credential
New-PSUSchedule -Cron "*/5 * * * *" -Script "Test3.ps1" -TimeZone "Europe/Vienna" -Credential "Default" 
New-PSUSchedule -Cron "0 23 * * 1-5" -Script "Test\Test.ps1" -TimeZone "Europe/Vienna"

This is a UI bug. I’ll get it fixed in 2.6.0. Thanks for all the info.

1 Like