Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

How to schedule tasks in VMware vCenter Server

  • September 14, 2018
  • 12 min read
Cloud and Virtualization Architect. Kevin focuses on VMware technologies and has vast expertise in cloud solutions, virtualization, storage, networking, and IT infrastructure administration.
Cloud and Virtualization Architect. Kevin focuses on VMware technologies and has vast expertise in cloud solutions, virtualization, storage, networking, and IT infrastructure administration.

Introduction

Being a sysadmin often means doing some boring stuff on a daily basis. Well, sure, you can use PowerCLI to save yourself the hassle. It’s a powerful tool that I believe any vSphere admin should master at some point. While PowerCLI provides you the ultimate freedom of IT infrastructure management, there’s still a workaround to automate some tasks even through GUI.

For instance, you need, let’s say, to take a VM snapshot regularly, but you cannot write a script for that purpose yet. You still can automate that process and some other tasks with vCenter Server inbuilt task scheduler. No vCenter? No problems, you can schedule some processes on ESXi! The only thing is that you may be limited to the guest OS inbuilt scheduler capabilities. For more freedom, you need some PowerShell and PowerCLI skills. In today’s article, I look through some tasks that you can automate with vCenter and teach you how to schedule them.

Ok, so, what can I schedule?

Here’s the list of tasks I was able to schedule in vCenter.

Component Task Description
vCenter Scan for updates Scans for vCenter available updates. Note that you need vSphere Update Manager for this task
Datacenter and Cluster New Virtual Machine Creates a new VM in the cluster.
Add Host Adds the host to the specified datacenter or cluster.
Scan for updates Checks the available updates for the specified datacenter or cluster.
Host New Virtual Machine Creates the VM on the specific host.
Scan for updates Scans the host for available updates. vSphere Update Manager is needed for this task.
VM Power On Powers on the particular VM.
Shut Down Guest OS Shuts down the VM gracefully. Note that you need VMware Tools for scheduling this task.
Restart Guest OS Reboots the VM. VMware Tools are needed to schedule this task.
Power Off Powers off the particular VM.
Suspend Suspends the VM.
Reset Resets the VM state.
Migrate Migrates a VM to the specified host or datastore. You can also migrate it with vMotion
Clone to Virtual Machine Clones the VM and places it on the specified host or cluster.
Edit Resource Settings Allows changing resources dedicated to the specific VM. You can change CPU and memory shares and limits.
Take Snapshot Captures the VM snapshot.
Scan for Updates Checks for available VM updates. You need vSphere Update Manager for this task.

How things look in vCenter Server

For vCenter, you can schedule scanning for updates. Well, in my case, that was the only option available in the Schedule a New Task dropdown menu.

Зображення, що містить текст, програмне забезпечення, Комп’ютерна піктограма, Веб-сторінка Автоматично згенерований опис

For a datacenter and cluster, you can schedule the following tasks: New Virtual Machine, Add Host, and Scan for Updates. Well, that’s exactly what I could schedule. Here’s how the Schedule a New Task dropdown list looked like for these vSphere objects in my case.

Зображення, що містить текст, знімок екрана, програмне забезпечення, Комп’ютерна піктограма Автоматично згенерований опис

For the host, you can schedule New Virtual Machine and Scan for Updates.

Зображення, що містить текст, знімок екрана, програмне забезпечення, Комп’ютерна піктограма Автоматично згенерований опис

How to schedule task with vCenter

Most of the boring stuff you do is often somehow related to the VMs. And, you know, vCenter allows you scheduling a bunch of things for VMs:

  • Power On
  • Shut Down Guest OS
  • Restart Guest OS
  • Power Off
  • Suspend
  • Reset
  • Migrate
  • Clone to Virtual Machine
  • Edit Resource Settings
  • Take Snapshot
  • Scan for Updates

First, I want to talk specifically about VM snapshot scheduling.

VM snapshot scheduling

First, select the VM. Navigate to the Monitor tab next and click Tasks & Events. Press Scheduled Tasks and select Take Snapshot… from the Schedule a New Task dropdown menu. In the Scheduled Tasks menu, you can find all the scheduled tasks on the list. Remember to be smart and name the tasks properly so that neither you nor your colleagues have troubles with recognizing what each of them is for.

Зображення, що містить знімок екрана, текст, програмне забезпечення, Комп’ютерна піктограма Автоматично згенерований опис

Now, you can play around with the snapshot scheduling settings. Enter the task name in the self-titled field first. You can also add the task description. The most important settings in the snapshot scheduling process (just as in any other operation scheduling) are in the Change menu. There, you can set when and how often operations are performed. Press OK once you are done with scheduling.

Зображення, що містить текст, знімок екрана, програмне забезпечення, Веб-сторінка Автоматично згенерований опис

Once the scheduled task works out, you can find it on the History list.

Зображення, що містить текст, програмне забезпечення, Веб-сторінка, Комп’ютерна піктограма Автоматично згенерований опис

Now, I’m going to talk about those three buttons on the right of the Schedule a New Task dropdown menu. These buttons, as it comes from their signs, allow running, editing, and removing the task. Note that there’s a small thing about the Run button: the task is executed right after you press it irrespective of the schedule.

Зображення, що містить текст, знімок екрана, програмне забезпечення, Веб-сторінка Автоматично згенерований опис

Scheduling a new VM creation

Now, let’s take a look at how you automate a new VM creation. Select the New Virtual Machine… option from the Schedule a New Task dropdown menu. In the Select a creation type menu, there will be only the Create a new virtual machine option available.

Зображення, що містить текст, знімок екрана, програмне забезпечення, Веб-сторінка Автоматично згенерований опис

On the whole, scheduling the New Virtual Machine task looks pretty much like if you were just creating a VM. The only difference is that you can make this action repetitive.

You need to edit VM settings first, and then you can move to setting how often and when the task is executed. Well, I believe there’s not much to tell you about VM creation, so I leave all the VM settings by default and jump right to the scheduling procedure. In the Scheduling options menu, you can add the description for the task and set how often and when you need it to be performed.

Зображення, що містить текст, знімок екрана, програмне забезпечення, Веб-сторінка Автоматично згенерований опис

Once the task scheduled, it is displayed on the Scheduled Tasks list in vCenter.

Зображення, що містить текст, знімок екрана, програмне забезпечення, Веб-сторінка Автоматично згенерований опис

Being executed, the task is listed in the history and has its status changed to success. Now, you have a new VM!

Зображення, що містить текст, знімок екрана, програмне забезпечення, Веб-сторінка Автоматично згенерований опис

Conclusion

Today, I provided you with the handy workaround to automate some tasks with vCenter. Sure, you still need some PowerCLI skills for the ultimate freedom of your vSphere environment management. In this article, I described many things you can schedule just using vCenter.

Found Kevin’s article helpful? Looking for a reliable, high-performance, and cost-effective shared storage solution for your production cluster?
Dmytro Malynka
Dmytro Malynka StarWind Virtual SAN Product Manager
We’ve got you covered! StarWind Virtual SAN (VSAN) is specifically designed to provide highly-available shared storage for Hyper-V, vSphere, and KVM clusters. With StarWind VSAN, simplicity is key: utilize the local disks of your hypervisor hosts and create shared HA storage for your VMs. Interested in learning more? Book a short StarWind VSAN demo now and see it in action!