Help with workflow - Error when tried to resume the job after a restar


I’m using workflow and, as seen in this sample page to resume automatically the workflow after restart I create a scheduled job but, when the system restarts and I do a control in the job list, I can see that the job is in “Failed” state and if I find the error it seems this:

Parameter set cannot be resolved using the specified named parameters.
+ CategoryInfo          : InvalidResult: (:) [], RemoteException
+ FullyQualifiedErrorId : ScheduledJobFailedState

To test, I written this code:

workflow test-reboot {

       sequence {

            Uninstall-WindowsFeature -ComputerName aoam -Name "Web-Server" -IncludeManagementTools

            Restart-Computer -Wait -Force -PSComputerName aoam

            Start-Sleep 5

            Install-WindowsFeature "Web-Server" -ComputerName aoam -IncludeManagementTools

            Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementScriptingTools,IIS-FTPServer -All

            Unregister-ScheduledJob -Name ResumeWorkflow



$adm = "MyDomain\Administrator"

$pwd = ConvertTo-SecureString -String "password" -AsPlainText -Force

$cred = New-Object System.Management.Automation.PSCredential($adm, $pwd)

Register-ScheduledJob -Name ResumeWorkflow -Credential $cred -ScriptBlock {Import-Module PSWorkflow; Get-Job -Name ResumeSetup -State Suspended | Resume-Job}

$AtStartup = New-JobTrigger -AtStartup

Add-JobTrigger -Trigger $AtStartup -Name ResumeWorkflow

test-reboot -JobName ResumeSetup

When the system restarts and I do a Get-Job, ResumeWorkflow is in Failed state while ResumeSetup I suspended. I have done a

$job = Get-Job -Id [the id of ResumeWorkflow]

and it show the error written first.
I also tried without the credential part, but the issue is the same.

Any idea?