Reading and Writing Remote Disk

The DoEdit() function is similar for remote managed virtual disk on ESXi hosts, but beforehand you must call VixDiskLib_Connect() with authentication credentials instead of passing NULL parameters.

    if (appGlobals.isRemote) {
          cnxParams.vmxSpec = NULL;
          cnxParams.serverName = appGlobals.host;
          cnxParams.credType = VIXDISKLIB_CRED_UID;
          cnxParams.creds.uid.userName = appGlobals.userName;
          cnxParams.creds.uid.password = appGlobals.password;
          cnxParams.port = appGlobals.port;
    }
    VixError vixError = VixDiskLib_Init(1, 0, NULL, NULL, NULL, NULL);
    CHECK_AND_THROW(vixError);
    vixError = VixDiskLib_Connect(&cnxParams, &appGlobals.connection);