Automation

 View Only
  • 1.  Creating custom scheduled tasks in vCenter

    Posted Dec 29, 2023 07:48 PM

    Can a custom scheduled task be created using PowerCLI or another method?  There are only canned scheduled tasks in the vSphere UI, and new ones cannot be made.  I've been banging my head trying to learn about Get-View and using the developer documentation.  I can manually add a cron job to each ESXi, but that's inefficient.  

    Example:  My goal is to have vCenter start the SSH service of each host in the cluster at a specific time without using Windows task scheduler to start a PowerShell script.



  • 2.  RE: Creating custom scheduled tasks in vCenter

    Posted Dec 29, 2023 08:11 PM

    What do you mean by "... and new ones cannot be made."?



  • 3.  RE: Creating custom scheduled tasks in vCenter

    Posted Dec 30, 2023 01:20 AM

    I meant new custom-scheduled tasks can't be created.



  • 4.  RE: Creating custom scheduled tasks in vCenter

    Posted Dec 30, 2023 08:42 AM

    Care to elaborate on that?
    Do you get an error?
    Are there permissions missing?



  • 5.  RE: Creating custom scheduled tasks in vCenter

    Posted Jan 04, 2024 03:55 AM

    Apologies for the lack of context.  For example, the system is running vCenter build 21784236.

     

    From the Cluster object >> Configure >> Scheduled Tasks >> New Scheduled Task

    Three canned tasks can be created:

    1. New virtual machine
    2. Add Host
    3. Edit DRS

     

    I want to create a Custom Scheduled Task other than the above-mentioned ones. For example:

    • Task: Start a service
    • Target: Hosts in this cluster
    • Service: Start SSH
    • Run: Once a week on Wednesday at 3:33 pm

     

    I could create a cron job on every host, but I would prefer to automate the process.



  • 6.  RE: Creating custom scheduled tasks in vCenter

    Posted Jan 04, 2024 06:43 AM

    You can create scheduled tasks using some methods (via the MethodAction object), but starting the SSH service, or any service on an ESXi node, is not a supported method I'm afraid.