The properties of a PowerCLI view contain information about the state of the server-side object at the time the view was created.

In a production environment, the state of managed objects on the server changes constantly. However, the property values of the objects are not updated automatically. You can synchronize the values of client-side views with the corresponding server-side objects by using the UpdateViewData() method.

The following code example refreshes the power state information of a virtual machine by using UpdateViewData() method.

using VMware.Vim;
using System.Collections.Specialized;
namespace Samples {
	public class Example2_2 {
		public void PowerOffVM() {
			VimClient client = new VimClient();

			IList<EntityViewBase> vmList =
	client.FindEntityViews(typeof(VirtualMachine), null, filter, null);
	// Power off the virtual machines.
	foreach (VirtualMachine vm in vmList) {
		// Refresh the state of each view.
		if (vm.Runtime.PowerState == VirtualMachinePowerState.poweredOn) {
			Console.WriteLine("Stopped virtual machine: {0}", vm.Name);
		} else {
			Console.WriteLine("Virtual machine {0} power state is: {1}", vm.Name, vm.Runtime.PowerState);