VMware Horizon Community
derekn
Enthusiast
Enthusiast

Scripting VM's to shutdown and restart at certain intervals.

I am trying to figure a way to change a VM's power state. I know I can schedule individual VM's to power down from scheduler, but lets say I want all the VM's in a particular folder to shutdown at 7pm and then restart at 6am. Is there a way to script this?

-go easy
Reply
0 Kudos
9 Replies
admin
Immortal
Immortal

Hi,

you can use the VI SDK: http://www.vmware.com/support/developer/vc-sdk/

With this Software Development Kit you can use almost any programming language to script or develop your own applications.

Was this answer helpful for you? Please use the correct/helpful buttons!

Reply
0 Kudos
derekn
Enthusiast
Enthusiast

Thanks for the link. I am aware of the SDK but really have no knowledge in scripting. I guess I will have to do some further studying and see if I can figure this one out.

-go easy
Reply
0 Kudos
patrickrouse
Enthusiast
Enthusiast

Derek, we have this option for VMs and Physical Computers in the Provision Networks Connection Broker. Screenshots below:

2788_2788.JPG

2789_2789.JPG

2790_2790.JPG

Patrick Rouse

Microsoft MVP - Terminal Server

Sr. Sales Engineer, Western USA & Canada

Quest Software, Provision Networks Division

Virtual Client Solutions

(619) 994-5507

Reply
0 Kudos
mike_laspina
Champion
Champion

Hi,

Yes it is scriptable, but unless you are willing to dive in an use the VMware Toolkits you will not have any luck with scripting.

Here is an example on something I created to update VMware tools on VM clients.

You could modify it to shutdown and startup if you are adventurous.

http://blog.laspina.ca/roller/Ubiquitous/entry/automated_vmware_tools_upgrades_using

http://blog.laspina.ca/ vExpert 2009
derekn
Enthusiast
Enthusiast

I am starting to look into the tool kit. It just seems that you could be able to schedule a group of vm's (or a folder) to shut down. Perhaps that is in 3.5, I will have to check my test lab at home tonight.

I am not to sure of what provision is or understand why I would have to buy a full product to do this...but thanks for the suggestion.

-go easy
Reply
0 Kudos
patrickrouse
Enthusiast
Enthusiast

Derek, are you using a Connection Broker, or are you managing your Virtual Desktops with Virtual Center? If you are managing your Virtual Destkops with Virtual Center, then at the most basic level a Connection Broker is the piece of software that:

1. Automates the creation and sysprep of Virtual Machines

2. Assigns VMs to Users

3. Powers VMs on or resumes a VM when requested by a client

4. Suspends a VM when it's idle

There many companies that make connection brokers for different virtual infrastructures. At VMworld 2006 in Los Angeles three companies brought VDI Connection Brokers to market:

Provision Networks (now part of Quest Software)

Leostream

Propero (acquired by VMware and functionality is now part of the VDM2 product)

Since this time many companies have gotten into the connection broker market, but the main players are Provision Networks Virtual Access Suite, VMware VDM2.1 and Citrix XenDesktop.

I suspect that you're not using a connection broker, since you're referring to "folders" instead of "pools" and version "3.5" which is the latest version of ESX, whereas VMware's connection broker VDM is at version 2.1.

Some of the features that we offer on top of the basic "connection brokering" :

Universal Printing (no need to install printer drivers on VMs to support client's printers)

Scheduling of the Power State, OS Operations, Deletion of VMs, Software Installation, Enable/disable virtual desktops or entire destkop groups, execution of scripts, copying of files....

Dynamic creation of new Virtual Desktops based on a rule that you specify, i.e. I always want X number of machines online that are not in use, so new machines will be provisioned "before" they are requested by users.

Simultaneous building of machines across multiple resource pools and datastores based on four different criteria

Dynamic management of the Remote Desktop Users, Administrators and Power Users Groups

Restrict access to virtual desktops or desktop groups by day of week or time of day

SSL Gateway (for remote access) and ASP.Net Customizeable Web Portal or Sharepoint Part

Application Publishing (in case you want to deliver seamless applications to users, instead of a destkop, i.e. for users that already have a PC, instead of a thin client)

True Multi-monitor support, so the Virtual Desktop knows you have multiple monitors, instead of just spanning across multiple monitors.

Multimedia Redirection, so you can (optionally) run full motion Multimedia content using the client's CODEC, instead of rendering the video stream via RDP

Local Text Echo (so client keystrokes are displayed on the client, before being sent to the virtual desktop, in the event that there is a highly latent network connection

Bi-directional audio, to support microphones

Hybrid User Profile Management so the administrator can specify what parts of the Windows user profile a user can customize so those settings will be maintained from session to session, regardless of the Virtual Destkop, without using Roaming Profiles.

Desktop Configuration and Lockdown including; applying ADM Template Settings (so you don't have to manage them via GPO), mapping of drives and network printers, VDI specific logon scripts, restrict access to specific applications and the time of day and day of week users can access the apps, restrict access to specific host IP Addresses or names and TCP Ports, add/delete registry entries/keys, intercept and redirect files/folders/registry to alternate locations so an application that typically needed administrative rights to operate can now be run by a non-admin user

Integration with Microsoft Application Virtualization (softgrid)

Publish Applications or Desktops from Physical PCs, Blade PCs or Windows Terminal Services

Power Management of physical PCs or Blade PCs

Kerberos, Smartcard, Passthru authentication

Clients for Windows, Windows CE, Java, Linux, Sun, Wyse Thin OS (WTOS)

Integration with and automation of VMware, Microsoft Hyper-V, Virtual Iron and Parallels Virtuozzo (from the same administrative console, in case you need to support a heterogenous environment)

There is an modular architectural diagram of the Provison Networks Connection Broker here, on our blog:

http://blogs.inside.quest.com/provision/2008/05/31/provision-networks-connection-broker-architecture...

Patrick Rouse

Microsoft MVP - Terminal Server

Sr. Sales Engineer, Western USA & Canada

Quest Software, Provision Networks Division

Virtual Client Solutions

(619) 994-5507

http://www.provisionnetworks.com

http://blogs.inside.quest.com/provision

Reply
0 Kudos
derekn
Enthusiast
Enthusiast

I am currently managing my vm desktops with VC, we are using Panologic devices and I was trying to find a way to manage the vm's to shut down to conserve power and resources on the hosts that they lie upon. I am doing 1 to 1 vm's to pano's so utilizing desktop pools is not in effect for my environment. I am individually creating these vm's, well I am using templates and assigned static ip's as our shop requires that.

-go easy
Reply
0 Kudos
babysham
Contributor
Contributor

Would you want to pay someone to write it for you?

Reply
0 Kudos
derekn
Enthusiast
Enthusiast

I am not at that point yet, I am still investigating the SDK and trying to figure this out.

-go easy
Reply
0 Kudos