search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
SCVMM: VM Deployment Script on Powershell
Posted in Virtual Machine Manager, Windows Powershell | No Comment | 4,300 views | 10/02/2009 13:14

This is a basic deployment script for SCVMM to create VMs from templates. It was built in Turkish so I tried to translate it. You can adaptade this script to your own environment.

Popup menu codes are written by yefimovah. Link: www.powershellcommunity.org/Forums/tabid/54/aff/14/aft/487/afv/topic/Default.aspx

But all others codes are written by me. Please let me see your own script if you use and advanced this codes.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Adding PS Snapin for SCVMM
 
Add-PSSnapin -name Microsoft.SystemCenter.VirtualMachineManager
 
Get-Vmmserver localhost
 
# Pause Function
 
function Pause ($Message="Press any key to continue..")
{
Write-Host -NoNewLine $Message
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host ""
}
 
# Let's Create JobID
 
$JobGroupId = [Guid]::NewGuid().ToString()
 
# Sort VMs by Location
 
# get-vmhost hyperv01.fabrikam.contoso.net | Get-VM | Get-VirtualHardDisk | sort-object Location | Format-List Name,Location
 
# Pause
 
# get-vmhost hyperv02.fabrikam.contoso.net | Get-VM | Get-VirtualHardDisk | sort-object Location | Format-List Name,Location
 
# Pause
 
# Let's Create Pop-up Menu
 
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | out-null
 
# Variables
 
$form = new-object system.windows.forms.form

You can download all codes from here: http://www.yusufozturk.info/wp-content/uploads/2009/02/deployscriptps1.txt

Please leave a comment if you like or use it.



Leave a Reply