Skip to content

VMware vSphere 7 - Create Virtual Machine over the vSphere API

Notifications You must be signed in to change notification settings

tinohager/Vmware.Vsphere.Api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Vmware.Vsphere.Api

VMware vSphere 7 - Create Virtual Machine over the vSphere API

var vcenterUrl = "https://vcenter01.domain.local";
var vcenterUser = "[email protected]";
var vcenterPassword = "";
var esxDatastoreName = "MyDatastoreName";
var esxHostName = "MyEsxHost";

var client = new VsphereClient(vcenterUrl);
await client.LoginAsync(vcenterUser, vcenterPassword);

var enviormentConfig = new EnviormentConfig
{
	DatastoreName = "MyDatastoreName",
	HostName = "MyEsxHost",
	NetworkName = "NetworkName"
};

var virtualMachineConfig = new SimpleVirtualMachineConfig
{
	Name = "MyUbuntuServer1",
	GuestOs = GuestOs.UBUNTU_64,
	Cpus = 2,
	DiskSizeGB = 40,
	MemorySizeGB = 4,
	IsoFile = "[MyIsoDatastoreName] ISO/ubuntu-20.04.1-live-server-amd64.iso",
};

await client.CreateVirtualMachineAsync(enviormentConfig, virtualMachineConfig);

await client.LogoutAsync();

Releases

No releases published

Packages

No packages published

Languages