How to connect vCenter using SDK?

1 min readUpdated

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.

 

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");          
        }
    }
}

Next – Get Managed Object

Share this article LinkedIn X

Leave a Comment