示例#1
0
        /// <summary>
        /// Powers off the specified virtual machine.
        /// </summary>
        /// <param name="vmObject">The <see cref="VSphereManagedObject" /> representing the virtual machine.</param>
        /// <returns>A <see cref="VSphereManagedObject" /> representing the task created by the power on operation.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="vmObject" /> is null.</exception>
        public VSphereManagedObject PowerOffVirtualMachine(VSphereManagedObject vmObject)
        {
            if (vmObject == null)
            {
                throw new ArgumentNullException(nameof(vmObject));
            }

            ManagedObjectReference task = _vimService.PowerOffVM_Task(vmObject.ManagedObjectReference);

            return(new VSphereManagedObject(task));
        }