Product: PowerShell Universal Version: 5.5.0
Noob here…
I am trying to create a one-time schedule through an App. User can decide to run a task right away or schedule the execution later. The One-Time schedules would be perfect for this, but I cannot find any documentation on how we can do this programmatically.
I tried creating a One-Time job to see if I could get the script for it in the schedules.ps1 file, but it ain’t there either. (Which makes me think.. what happen if I create a one-time job then I restart PSU? Will it be lost?).
I managed to implement everything needed with a CRON job, but it then gets repeated (obviously..). Has anyone implemented something similar already? Just starting with PSU, so it’s probably an easy one that I can’t figure out…
Hi,
I have something similar and this works for me (which is only an example):
Connect-PSUServer -ComputerName "<Servername>" -AppToken "<yourAppToken>" | Out-Null $Script = Get-PSUScript -Name "<Scriptname>" -TrustCertificate $Time = (Get-Date).AddMinutes(30).ToUniversalTime() # or any other date which your user can choose New-PSUSchedule -Script $Script -OneTime $Time -TimeZone "<Timezone>" -TrustCertificate
Which will look like this:
14ff29069134e771be3ff8c524c59ff7bbc5cf6c.png