The C# (.NET) sample programs are located in the SDK\vsphere-ws\dotnet\cs\samples\ directory. Details listed in
C# (.Net) Sample Programs. Each of the examples listed in the table is actually a directory that contains a
.cs file, a
.csproj file, a
filename2008.csproj file, and a
filename2010.csproj file.
The readme file explains how to build the examples using Visual Studio 2005 or Visual C# 2005 Express.
|
|
|
|
|
|
|
|
|
■
|
AppUtil – Utility application that drives the user input mechanism for other samples and includes some other utility functions.
|
■
|
CertPolicy – Handles certification problems by displaying informational messages.
|
■
|
ClientUtil – Client utilities related to prompting the user and logging. Used by AppUtil.
|
■
|
Log – Logger to file or console.
|
■
|
ServiceUtils, ServiceUtilsV25 – Utilities for connecting to the server.
|
■
|
VMUtils – Utility that sets values for a basic virtual machine. Some of the setup, such as adding a floppy disk drive, might not always be needed.
|
|
|
Uses the PerformanceManager for basic monitoring.
|
|
Retrieves the contents of the ServiceInstance starting at the root folder, and prints a listing of ManagedEntity objects. Optionally, obtains properties for a specific type, or by default, for ManagedEntity itself.
|
|
CIMInfo versioning sample that retrieves the details of CIM_Fan like Activecooling, Caption, CommunicationStatus and so on.
|
|
|
|
|
|
Creates a Folder, Cluster, Datacenter or standalone host. Prompts the user for the item to create and where to put the item, for example, in a folder.
|
|
|
|
|
|
|
|
Extracts a task from scheduledTaskManager and deletes it. This sample is well commented and illustrates using the PropertyCollector. You can create the task using the OneTimeScheduledTask example.
|
|
|
|
|
|
|
|
|
|
Creates an EventHistoryCollector and monitors the corresponding events.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Creates a ScheduledTask that powers off a virtual machine and schedules the task using a OnceTaskScheduler. You can delete the task using the DeleteOneTimeScheduledTask commandlet.
|
|
Defines a printEntityCounters function that prints counters for a virtual machine, host, or resource pool.
|
|
|
|
Illustrates use of the QueryMemoryOverhead method. The folder includes two examples, QueryMemoryOverheadV25 uses the currently valid QueryMemoryOverheadEx method, QueryMemoryOverhead uses the deprecated QueryMemoryOverhead method.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Creates an alarm that monitors virtual machine state and sends email if the virtual machine power is off. Includes error handling, for example, when the command is attempted with an ESX/ESXi host as a target.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
■
|
Creating EventHistoryCollector filtered for a single virtual machine.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Demonstrates how to use the PropertyCollector to monitor one or more properties of one or more managed objects. In particular this sample monitors one or all virtual machines and all hosts or one host for changes to some basic properties.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
An esxtop-like sample application that lets administrators specify the CPU and memory counters by name to obtain metrics for a specified host.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Displays the CanonicalName, Vendor, Model, Data, Namespace and NamespaceId of the host’s SCSI LUN.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Samples in the version directory illustrate running against hosts that have different versions of vSphere or VMware Infrastructure installed.
The HostPowerOps sample includes running against Virtual Infrastructure 2.0. The other samples apply to Virtual Infrastructure 2.5 and later versions including vSphere 4.0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Uses the HostPatchManager managed object to upgrade the components in an ESXi system.
|
|
|
|
|
|
|