共用方式為


IVMAccountant::UpTime property

The UpTime property contains the number of seconds that the virtual machine has been running.

This property is read-only.

Syntax

HRESULT get_UpTime(
  [out] long *secondsAlive
);

VB
VMAccountant.UpTime( _
  ByRef secondsAlive _
)

Property value

The number of seconds that the virtual machine has been running.

This property value is read-only.

Error codes

Name Meaning
S_OK
The operation was successful.
E_POINTER
secondsAlive is NULL.
S_FALSE
The virtual machine is not running.
DISP_E_EXCEPTION
An unexpected error occurred.

Examples

The following example prints the UpTime property information for each virtual machine.

Set objVS = CreateObject("VirtualServer.Application")
set colVMs = objVS.VirtualMachines

For Each objVM in colVMS
    Set colAccountants = objVM.Accountant
        Wscript.Echo "Virtual machine: " & objVM.Name
        Wscript.Echo "Uptime: " & colAccountants.Uptime
        Wscript.Echo
Next

Requirements

Product
Microsoft Virtual Server 2005 onWindows Server 2003
Download
Microsoft Virtual Server 2005 R2 SP1 Update onWindows Server 2008orWindows Server 2003
Header
VsComInterfaces.h

See also

IVMAccountant