I have written a few articles about VMware and the PowerShell command let’s and at the VMworld 2008 EUROPE in Cannes you can explore the PowerShell interfaces for VMware Infrastructure in the Automating VMware with PowerShell: Hands-On Lab. But the downside of PowerShell is that there isn’t a nice user interface. Wouldn’t it be great to use the PowerShell .net library’s and connect to your Virtual Centre server with Visual Basic Express 2008. It isn’t documented but I have found a way to connect to VC using the following code :
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Config As New VMware.VimAutomation.Client20.VimClient
Config.ConnectivityService.Login("https", "VC.NTPRO.LOCAL", "443", "Admin", "vmware")
MsgBox(Config.ConnectivityService.IsConnected)
MsgBox(Config.ConnectivityService.GetApiInfo.ApiVersion)
End Sub
End Class
If everything goes well you will receive two message boxes, the first one will tell you “True? so you’re connected and the second one will display “2.5?, this is the version of the API. The remainder of the code is up to you, please let me know if you can stop and start a VM. The beta version of the VI3 Windows Toolkit will be launched in March.