Skip to content

Instantly share code, notes, and snippets.

@thattommyhall
Created October 1, 2010 15:44
Show Gist options
  • Save thattommyhall/606368 to your computer and use it in GitHub Desktop.
Save thattommyhall/606368 to your computer and use it in GitHub Desktop.
param(
[string]$type=$(Throw "Parameter Missing: -type ?barebone/webserver/database?"),
[string]$machinename=$(Throw "Parameter missing: -machinename <MACHINENAME>"),
[string]$size=$(Throw "Parameter missing: -size ?small/medium/large?"),
[string]$vlan=$(Throw "Parameter missing: -vlan ?TRAF-TRU/TRAF-TEST/TRAF-DMZ?"),
[string]$creator=$(Throw "Parameter missing: -creator <CREATOR>")
)
#set numCPU and memory according to size
Switch ($size)
{
'small' {$memory = 512; $numcpu = 1}
'medium' {$memory = 2048; $numcpu = 1}
'large' {$memory = 4096; $numcpu = 2}
}
Switch ($type)
{
'barebone' {$poolserverstr = 'bbpool'}
'webserver' {$poolserverstr = 'wspool'}
'database' {$poolserverstr = 'dbpool'}
}
#Choose Server
#$poolserver = Get-VM | ? {($_.name -match $poolserverstr) -and ((Get-Annotation -CustomAttribute Creator -Entity $_) -eq 'pool')}
$poolserver = Get-VM -Name 'TOMDEPLOYTEST2'
#Set annotation
Set-Annotation -Entity $poolserver -CustomAttribute 'Creator' -Value $creator
#Set name, RAM, NumCPUS
set-VM -VM $poolserver -Name $machinename -MemoryMB $memory -NumCpu $numcpu -Confirm:$false
#PrepOS
#&"e:\bin\plink deploy@$poolserver 'sudo /opt/script/preparemachine.sh -i $ipaddress -n $vmname'"
#Set VLAN
#Reboot
#Restart-VMGuest -VM $machinename
#svMotion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment