In a previous post about use cases for IT Process Automation and Workflow Studio I mentioned building a workflow to facilitate a "Green Data Center". Workflow Studio can help with this by managing the workloads on your servers and turning servers off when they are not needed. In this post I will show you 2 ways that you can shutdown a windows server from a workflow (these are native to Windows, if you are using 3rd party tools let me know in the comments.)
- "Launch Process" Task - Windows has a built-in utility (shutdown.exe) that can shutdown computers on your network remotely. Using the Workflow Studio "Launch Process" task allows you to call the shutdown command and pass it the arguments you want for your needs. You can see all the arguments by typing "shutdown /?" at your command line and there are several detailed write-ups on Microsoft's site (here and here for example).
- "PowerShell Script" Task - WMI has a class (Win32_OperatingSystem) that can be used to shutdown computers as well. Workflow Studio has a task called "Get WMI Info" that is designed to query WMI classes, but unfortunately it cannot call methods on the WMI classes. We will need to leverage a scripting environment like PowerShell to be able to call the method (or you could use VBScript.) Fortunately, in PowerShell we only need one line of code to achieve this:
(Get-WmiObject -Class Win32_OperatingSystem -ComputerName <computer name>).shutdown()
Add that line of code to your "PowerShell Script" task and replace the <computer name> with the name of the computer you would like to shutdown.
In this post I looked at shutting down a Windows Server, but in future posts I will expand this and look at how to use Wake On LAN to power machines back on, how you can manage power on a XenServer host machine, and how you can integrate this with logic to monitor when to shut down and start up your servers.
Power management is an area that we are working diligently on internally to build out a robust set of tasks for you. Have you tried automating server shutdown processes in your data center? What issues do you face? What kinds of inputs do you want to be able to leverage to determine when to shutdown a server?
Comments (5)
Jul 09, 2008
Anonymous says:
Peter I'm developing a product to shut down / start up many different types of ...Peter
I'm developing a product to shut down / start up many different types of systems (Windows, Unix, anything that can be communicated with) in response to automated (e.g. environmental failure) or manual commands (e.g. from a help desk). This work is in response to a lack of vendor independent, fully featured tools available especially from UPS vendors. They all have shutdown software but it's pretty limited, e.g. many need direct cable connect, most only work with their UPSs etc etc.
I hope your thread generates some activity.
Cheers
Ed
Jul 10, 2008
Peter Schulz says:
Ed, I would love to hear more about your product. Feel free to contact me via e...Ed,
I would love to hear more about your product. Feel free to contact me via email if you want to discuss ways we could integrate your product directly into Workflow Studio.
Thanks,
Pete
Anonymous replies:
Dec 27, 2008
Anonymous says:
Hi Pete/Ed, I am also interested in any product that can currently do this. I a...Hi Pete/Ed,
I am also interested in any product that can currently do this. I am not a member here but my email address is jdgriffith1982 at gmail. If you guys have developed/found any products that can do this efficiently please let me know!!
Thanks,
Justin
Jan 25, 2009
Simon Bramfitt says:
Justin I've published a summary of available server power management tools here...Justin
I've published a summary of available server power management tools here
WFS was released just after I published the post, I'll be addressing it and other similar workflow automation products in the near future.
Regards
Simon
Jan 25, 2009
Peter Schulz says:
Good post Simon! Workflow Studio 1.0 is a beginning to an overall platfor...Good post Simon!
Workflow Studio 1.0 is a beginning to an overall platform strategy for allowing Citrix , our partners, and our customers the opportunity to build useful utilities around our products and also integrate them with 3rd party products in the data center. The Power Management capability is one of the first we plan to address directly, so stay tuned. You will soon be able to deploy something equivalent to PowerSmart in a fully supported manner.
Add Comment