Windows PowerShell Scripting in Virtual Machine Manager
Microsoft System Center Virtual Machine Manager 2007 is a server application that you can use to manage a large number of virtual machines. This guide provides sample Microsoft Windows PowerShell scripts for Virtual Machine Manager. The sample scripts illustrate how you can manage the servers, virtual machines, and resources in your virtual environment.
The Virtual Machine Manager command shell is built on Microsoft Windows PowerShell, an administrator-focused, interactive command-line shell and scripting language that is integrated into the Windows operating system. Windows PowerShell and Virtual Machine Manager each provide commands, called cmdlets, that you can use separately to perform simple administrative tasks or together with other cmdlets or command-line elements to perform complex tasks. You can use Virtual Machine Manager cmdlets, and scripts that are created by using these cmdlets, as an alternative to (or in addition to) using the Administrator Console for centralized management of your physical and virtual system infrastructure.
Virtual Machine Manager uses a Microsoft SQL Server 2005 database to store Virtual Machine Manager objects that represent all entities in a Virtual Machine Manager environment. At minimum, a Virtual Machine Manager environment includes the following services, which you can install on a single server or on separate servers:
- Virtual Machine Manager server. A computer running Windows Server 2003 Service Pack 1 (SP1) that stores or accesses the SQL Server database, which contains Virtual Machine Manager objects.
- Host server. A computer running Microsoft Virtual Server 2005 R2 that functions as a host on which to deploy virtual machines.
- Library server. A computer running Windows Server 2003 with SP1 that stores a variety of resources for your virtual machine environment. Resources include hardware profiles, operating-system profiles, virtual machine templates, virtual hard disks (.vhd files), virtual floppy disks (.vfd files), ISO images (.iso files), and scripts. In addition, you can store virtual machines in the library that, currently, you do not want to deploy on a host.
- Web server. Optionally, Virtual Machine Manager also supports a Web server that acts as a Self-Service Portal for users who are allowed to create or manage their own virtual machines, or do both.
In Virtual Machine Manager, you can create virtual machines from a variety of sources, including from an existing stopped virtual machine that is already deployed on a host, from a virtual machine that is stored in the library, from a virtual hard disk, or from a template. Virtual Machine Manager supports physical-to-virtual machine conversion (P2V conversion) and virtual-to-virtual machine conversion (V2V conversion).
Understanding and experimenting with the sample scripts that are included in this guide provides a starting point for developing Windows PowerShell scripts that you can customize for use in your own Virtual Machine Manager environment.