• Skip to site navigation
  • Skip to blog entries
  • Skip to archive page
  • Skip to right sidebar

VB Programming with the ViClient.dll

Eric Sloof - NTPRO.NL

  • NTPRO.NL
  • Online Training
  • VMworld
  • Videos
  • Tools
  • iTunes
  • About

Thursday, 10 May 2007

VB Programming with the ViClient.dll

Source CodeThis week I overwhelmed Robert Baumstark with a lot of questions regarding his ViClient.dll. I started with downloading the pre build dll files from Rob’s website and added them as a reference to my Visual Basic application. So far so good, then I pasted the code from Rob under a button and there was trouble in paradise.  Rob warned that this code was written into an e-mail without testing and compiling so it could contain some typo’s and I did. Rob gave me a lot of good tips and hints and after a few hours of struggling there began to shine some light at the horizon. The hardest part of writing your own VMware VB application is to understand how the object references can address an object within your VI-3 environment . I took me some time to get a good grip on that subject. When you finally have all the pieces together you can start programming :-). I created a little demo witch query’s the VI-3 environment for information about Virtual Machines. Especially the number of CPU’s but my final goal is to query the VM’s that won’t start automatically when the ESX rebooted. This is the most forgotten setting in the properties of a VM and this topic isn’t covered in the VI3-IC course either. Another function I would like to add to my first application is to query all virtual machines in a DRS cluster for a connection to the CD player. This connection is important when you want to V-Motion a VM to another host. So I am happy to announce that my first handy application has seen the light. When you want to take a look at the source code just scroll down.  

Imports VIClient

Imports VimApi

Public Class Form1

    Dim X As New VIClient.VIClient

    Dim LogonForm As New VIClient.frmLogin

    Dim VM As New VimApi.ManagedObjectReference

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        LogonForm.aClient = X

        If LogonForm.ShowDialog() = Windows.Forms.DialogResult.OK Then

            MsgBox(X.ServiceContent.about.build)

            VM = (X.Session.FindByDnsName(X.ServiceContent.searchIndex, Nothing, "DNS name of VM", True))

            MsgBox(VM.Value)

            MsgBox(X.GetDynamicProperty(VM, "config.hardware.numCPU")(0).propSet(0).val)

        End If

        X.Disconnect()

    End Sub

End Class

 

 

 

Posted by
Eric Sloof
in VMware at 22:16
Bookmark and Share
Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as (Linear | Threaded)
No comments
The author does not allow comments to this entry


Twitter RSS FeedLinkedIn

www.hetesambal.nl

Veeam Webinar with Doug Hazelman: 5 Steps to Successful Backup & Replication for Hyper-V! Watch it now >>

Recent Entries

Video - vCloud Director 1.5 - Quick Start
Sunday, January 22 2012
White Paper - Mobility and Disaster Recovery Solution for Virtualized Tier-1 Enterprise Applications
Saturday, January 21 2012
Video - Install vSphere Syslog Collector and configure ESXi logging
Friday, January 20 2012
Storage Design and Implementation in vSphere 5.0 - The Rough Cuts
Thursday, January 19 2012
Top 25 Free Tools for VMware vSphere presented by David Davis and Kendrick Coleman
Monday, January 16 2012
LG Android running VMware Horizon Mobile hands-on
Saturday, January 14 2012
Forbes Guthrie has released the vSphere 5 vReference Card
Thursday, January 12 2012
VMworld Session - VMware vMotion in VMware vSphere 5: Architecture, Performance & Best Practices
Wednesday, January 11 2012
Voice Over IP (VoIP) Performance Evaluation on VMware vSphere 5.0
Tuesday, January 10 2012
VMware vCloud Director 1.5 Performance and Best Practices
Monday, January 9 2012

Archive

  • February 2012 (7)
  • January 2012 (22)
  • December 2011 (21)
  • November 2011 (24)
  • October 2011 (27)
  • September 2011 (26)
  • August 2011 (35)
  • July 2011 (26)
  • June 2011 (15)
  • May 2011 (20)
  • April 2011 (22)
  • March 2011 (22)
  • February 2011 (18)
  • January 2011 (13)
  • December 2010 (23)
  • November 2010 (18)
  • October 2010 (31)
  • September 2010 (22)
  • August 2010 (23)
  • July 2010 (19)
  • June 2010 (19)
  • May 2010 (19)
  • April 2010 (20)
  • March 2010 (23)
  • February 2010 (22)
  • January 2010 (30)
  • December 2009 (37)
  • November 2009 (29)
  • October 2009 (27)
  • September 2009 (36)
  • August 2009 (35)
  • July 2009 (35)
  • June 2009 (43)
  • May 2009 (35)
  • April 2009 (56)
  • March 2009 (51)
  • February 2009 (69)
  • January 2009 (69)
  • December 2008 (60)
  • November 2008 (56)
  • October 2008 (49)
  • September 2008 (63)
  • August 2008 (44)
  • July 2008 (54)
  • June 2008 (26)
  • May 2008 (34)
  • April 2008 (27)
  • March 2008 (38)
  • February 2008 (29)
  • January 2008 (35)
  • December 2007 (24)
  • November 2007 (23)
  • October 2007 (20)
  • September 2007 (54)
  • August 2007 (15)
  • July 2007 (22)
  • June 2007 (13)
  • May 2007 (8)
  • April 2007 (20)
  • March 2007 (10)
  • Recent...
  • Older...
Based on the s9y Bulletproof template framework
Powered by s9y – Template by Bulletproof development team.
  • NTPRO.NL
  • Online Training
  • VMworld
  • Videos
  • Tools
  • iTunes
  • About