Add VmNic
How to connect vCenter using SDK?
We can connect vCenter using VMware.Vim dll file in c# code easily. This file does exist in the PowerCLI folder in Windows. Using this connection, we can achieve almost all the tasks that we can perform using Web Client or vSphere Client. Please refer other posts to understand how we can perform tasks or gather inventory.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using VMware.Vim; namespace vSphere { class Program { static void Main(string[] args) { VMware.Vim.VimClientImpl client = new VimClientImpl(); ServiceContent sc = client.Connect("https://vCenterFqdn/sdk"); UserSession us = client.Login("user@domain", "password"); } } } |