Trouble re-enabling scheduled jobs

I use this function to register a scheduled job. It runs fine until I disable it, and then re-enable it (Enable-ScheduledJob). They are shown as Enabled in Task Scheduler. What might I be missing here?
(The credential below is the user name and I input the password when registering the job initially. This is also the admin)
Thanks

function Register-Execution{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[datetime] $time,

    [Parameter(Mandatory=$true)]
    [string] $jobName,

    [Parameter(Mandatory=$true)]
    [string] $pathToScript
)
$trigger = New-JobTrigger -Daily -At $time
$options = New-ScheduledJobOption -RunElevated 
Register-ScheduledJob  -Name $jobName -Trigger $trigger -Credential ".........." -FilePath $pathToScript

}

UPDATE j
SET j.Enabled = 0
FROM MSDB.dbo.sysjobs j
INNER JOIN MSDB.dbo.syscategories c ON j.category_id = c.category_id
WHERE c.[Name] = ‘Database Maintenance’;

I haven’t profiled it, but I suspect

USE msdb ;
GO

EXEC dbo.sp_update_job
@job_name = N’SomeJob’,
@enabled = 0;
GO

Will be generating the same code, but the builtin procs are usually the way to go.

Thanks. Still haven’t given up on Powershell though, if only to know why it fails here.