I have a problem with the creation of schedules by the graphical interface.
Regardless of the script and the parameters chosen, the schedule is added to the schedules.ps1 file but does not appear in the Automation > Schedules part of the administration portal.
Also, this schedule is never executed. Nothing appears in the jobs section.
I don’t have any trouble running scripts manually…
Do you have any solutions?
Here is the content of my schedules.ps1 file:
New-PSUSchedule -Script "Get-ADOrganizationalUnit.ps1" -TimeZone "System Default" -Continuous -Delay ([System.TimeSpan]::FromSeconds(630)) -Credential "Default" -Cred '$Admin' -Name "SCH_Get-ADOrganizationalUnit" -Timeout 10 -RandomDelay
Product: PowerShell Universal
Can you check in your notifications to see if you have anything referring to schedules.ps1? You may have an error showing up in the schedule file.
I hadn’t paid attention to the notifications:
Error Deserializing C:\ProgramData\UniversalAutomation\Repository\.universal\schedules.ps1
Cannot bind parameter because parameter 'Credential' is specified more than once. To provide multiple values to parameters that can accept multiple values, use the array syntax. For example, "-parameter value1,value2,value3".
After removing -Cred ‘$Admin’ from schedules.ps1, I see my schedule appear but it does not launch since the Cred parameter is missing.
New-PSUSchedule -Script 'Get-ADOrganizationalUnit.ps1' -TimeZone 'System Default' -Continuous -Delay ([System.TimeSpan]::FromSeconds(630)) -Credential 'Default' -Name 'SCH_Get-ADOrganizationalUnit' -Timeout 10 -RandomDelay
Is this an error on my side or does a bug prevent having additional parameters of the PSCredential type?
Thanks again. I’m close to migrating to version 2 of PowerShell Universal so this help is greatly appreciated.
The problem here is that the New-PSUSchedule cmdlet has a -Credential parameter. I’ve run into this problem myself and we should probably figure out how to fix it.
The workaround is to rename your -Crednetial parameter in your script to something else. Like this:
As long as I put something other than Credential or Cred as a parameter, it works.
I imagine Cred is an alias of Credential in Powershell Universal and obviously these are the 2 solutions that I had tested