¿ù°£ Àα⠰Խù°

°Ô½Ã¹° 58°Ç
   
[POWERSHELL] Hyper-V VMs Create Powershell
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2012-05-10 (¸ñ) 18:01 Á¶È¸ : 4307
±ÛÁÖ¼Ò :
                          

#Create-VM script TEST
# Total-Memory ¿Í »ç¿ëÁßÀÎ ¸Þ¸ð¸®¾ç Ãâ·Â (Çʵå¸í°ú ¼öÄ¡ Ãâ·Â)
$Meminfo = Get-WmiObject -Class Win32_OperatingSystem -Namespace root/cimv2 -ComputerName . | Format-List TotalVisibleMemorySize,FreePhysicalMemory
echo MemoryInfo $Meminfo
sleep(1)
 
# Àüü ¸Þ¸ð¸®°ªÀÇ ¼öÄ¡¸¸ Ãâ·Â
#$TotalMem = Get-WmiObject -Class Win32_OperatingSystem -Namespace root/cimv2 -ComputerName . | Format-Wide TotalVisibleMemorySize
 
# »ç¿ë°¡´ÉÇÑ ¸Þ¸ð¸®°ªÀÇ ¼öÄ¡¸¸ Ãâ·Â
#$UsedMem = Get-WmiObject -Class Win32_OperatingSystem -Namespace root/cimv2 -ComputerName . | Format-Wide FreePhysicalMemory
 for($i=50; $i -lt 76; $i++)
    {
 $VMname = "VM64_$i";
 $VMMem = "512"
 $VMcore = "4"
 $default_VHDdir = "c:\VHD_temp\"
 $default_VHD = "Win2008Web15G.vhd"
 $destVHDdir = "c:\VHD\$VMname"
 $destVHD = "\$VMname.vhd"
 $VM_Template = "$destVHDdir$destVHD"
       
 echo $VMname;
  echo $VNname "°¡»ó¸Ó½Å »ý¼ºÀ» ½ÃÀÛÇÕ´Ï´Ù."
  sleep(3)
 
  # °¡»ó¸Ó½Å »ý¼º
  echo "°¡»ó¸Ó½ÅÀ» »ý¼ºÁßÀÔ´Ï´Ù.."
  new-vm -name $VMname -server "localhost" -path $destVHDdir
  sleep(2)
 
  # ¸Þ¸ð¸® ÇÒ´ç
  echo "¸Þ¸ð¸® ÇÒ´çÇÕ´Ï´Ù."
  set-vmmemory -vm $VMname -memory $VMmem -server "localhost"
  sleep(2)
 
  # CPU_core ÇÒ´ç
  echo "CPU-Core¸¦ ÇÒ´çÇÕ´Ï´Ù."
  set-vmcpucount -vm $Vmname -cpucount $VMcore -server "localhost"
  sleep(2)
 
  # NIC Ãß°¡
  echo "°¡»ó ³×Æ®¿öÅ© ¾î´ðÅ͸¦ Ãß°¡ÇÕ´Ï´Ù."
  add-vmnic -vm $VMname -virtualswitch "·ÎÄà ¿µ¿ª ¿¬°á - °¡»ó ³×Æ®¿öÅ©" -server "localhost" -legacy
  sleep(2)
 
  # ±âº»VHD ÆÄÀÏÀ» »õ·Î »ý¼ºÇÑ VMÀ¸·Î º¹»ç
  echo "¿øº» VHDÆÄÀÏÀ» »ý¼ºÁßÀÎ °¡»ó¸Ó½ÅÀÇ Æú´õ·Î º¹»çÁßÀÔ´Ï´Ù."
  copy $default_VHDdir$default_VHD $destVHDdir$destVHD
 
  # »ý¼ºµÈ °¡»ó¸Ó½Å¿¡ Çϵåµð½ºÅ© Ãß°¡ ¹× º¹»çµÈ VHD ¿¬°á
  echo "VHD À̹ÌÁö¿¬°áÇÕ´Ï´Ù."
  add-vmdisk -VM $VMname 0 0 -path "$VM_Template"  -server "localhost"
  sleep(2)
 
  # »ý¼ºÇÑ °¡»ó¸Ó½Å Start
  echo "$VMname À» ½ÃÀÛÇÕ´Ï´Ù."
  start-vm $VMname
  sleep(2)
  echo "°¡»ó¸Ó½Å »ý¼ºÀÛ¾÷À» Á¾·áÇÏ¿´½À´Ï´Ù."
  sleep(5)
  }

À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.