VMwareserverstorage

How Create Virtual Machine with power cli

How Create Virtual Machine with power cli 1

To create a virtual machine using PowerCLI (VMware's PowerShell-based command-line interface), you can follow these steps:

1-Launch the PowerCLI application or open a PowerShell session and connect to your vCenter server using the Connect-VIServer cmdlet. Provide the necessary information, such as the server IP address, username, and password.

Powershell Script

Connect-VIServer -Server <vCenter-IP> -User <username> -Password <password>

2-Create a new virtual machine configuration using the New-VM cmdlet. Specify the desired parameters such as the name, datastore, resource pool, and guest operating system.

Powershell Script

$vmName = "MyVM"

$datastore = "MyDatastore"

$resourcePool = "MyResourcePool"

$guestOS = "windows9_64Guest"

New-VM -Name $vmName -Datastore $datastore -ResourcePool $resourcePool -GuestId $guestOS

3-Set the virtual machine hardware specifications using the Set-VM cmdlet. You can define parameters like CPU, memory, network adapters, and disk sizes.

powershell Script

$vm = Get-VM -Name $vmName

Set-VM -VM $vm -NumCpu 2 -MemoryGB 4

# Add a network adapter

$networkAdapter = Add-NetworkAdapter -VM $vm -NetworkName "VM Network"

4-Customize the virtual machine settings, such as adding disks or modifying advanced options. Use the appropriate cmdlets like New-HardDisk or Set-VMAdvancedConfiguration.

powershell Script

# Add a new virtual disk

$newDisk = New-HardDisk -VM $vm -CapacityGB 100 -Persistence "IndependentPersistent" -StorageFormat "Thick"

# Modify advanced configuration

Set-VMAdvancedConfiguration -VM $vm -Name "isolation.tools.diskShrink.disable" -Value $true

5-Power on the virtual machine using the Start-VM cmdlet.

Powershell Script

Start-VM -VM $vm

در همین موضوع بخوانید

همه مقاله‌ها
شبکه

معرفی NLB Cluster

این مقاله به تعریف و توضیح NLB Cluster یا توازن بار شبکه می‌پردازد. NLB یک تکنولوژی مایکروسافت است که برای توزیع بار شبکه بین چندین سرور استفاده…

server

معرفی پلتفرم vmware VSPhere Plus

vSphere+ یک پلتفرم مجازی‌سازی معروف و بسیار کارآمد است که می‌تواند به سازمان‌ها در صرفه‌جویی در هزینه‌ها و بالاتر بردن کارایی و امنیت سازمان‌ها کمک کند. این…