Shortcut Menu

Skip

Main Navigation

Choose your language

You are here:

ActiveXperts.com > Network Monitor > WindowsManagement > Scripts > Virtual Server > Virtual Machine and Virtual Server Properties

ActiveXperts Network Monitor
Monitor servers, workstations, devices and applications in your network

Quicklinks


Virtual Machine and Virtual Server Properties - Scripting

Create a Virtual Machine
Discard the Saved State of a Virtual Machine
Delete a Virtual Machine
Install Virtual Machine Additions
List Basic Virtual Machine Information
List Guest Operating System Information for a Virtual Machine
List Virtual Machine Keyboard Information
List Virtual Machine Mouse Information
List Virtual Machine Parallel Port Information
List Virtual Machine Serial Port Information
List Virtual Server Accountant Information
List Virtual Server Display Information
List Virtual Server Host Information
List Virtual Server Properties
List Virtual Server Support Driver Information
List Virtual Server Security Information
List Virtual Server Tasks
Modify a Virtual Machine Property
Modify Virtual Machine Scheduling Parameters
Modify Virtual Server Display Dimensions
Pause a Virtual Machine
Resume a Virtual Machine
Register a Virtual Machine
Return Virtual Machine Mouse Button Status
Save the Virtual Machine State
Shut Down the Guest Operating System on a Virtual Machine
Search for a Virtual Machine
Start a Virtual Machine
Turn Off a Virtual Machine
Unregister a Virtual Machine


You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.



Create a Virtual Machine


Creates a virtual machine named Script Machine.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
errReturn = objVS.CreateVirtualMachine("Scripted Machine", _
    "C:\Scripts\Shared Virtual Machines\Scripted")
	

Discard the Saved State of a Virtual Machine


Discards the saved state of a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")

errReturn = objVM.DiscardSavedState()
	

Delete a Virtual Machine


Deletes a virtual machine named Scripted Machine.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Scripted Machine")

errReturn = objVS.DeleteVirtualMachine(objVM)
	

Install Virtual Machine Additions


Installs Virtual Machine Additions for a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")

Set objGuestOS = objVM.GuestOS
objGuestOS.InstallAdditions()
	

List Basic Virtual Machine Information


Lists configuration information for all the virtual machines on a computer.
On Error Resume Next

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

For Each objVM in colVMS
    Wscript.Echo "Account name: " & objVM.accountname
    Wscript.Echo "Account name and password: " & objVM.Accountnameandpassword
    Wscript.Echo "Autostart at launch: " & objVM.Autostartatlaunch
    Wscript.Echo "Autostart at launch delay: " & objVM.Autostartatlaunchdelay
    Wscript.Echo "Baseboard serial number: " & objVM.Baseboardserialnumber
    Wscript.Echo "BIOS GUID: " & objVM.BIOSGUID
    Wscript.Echo "BIOS serial number: " & objVM.BIOSerialNumber
    Wscript.Echo "Chassis asset tag: " & objVM.ChassisAssetTag
    Wscript.Echo "Chassis serial number: " & objVM.ChassisSerialNumber
    Wscript.Echo "Config ID: " & objVM.ConfigID
    Wscript.Echo "Display: " & objVM.Display
    Wscript.Echo "File: " & objVM.File
    Wscript.Echo "Floppy autodetect enabled: " & objVM.FloppyAutoDetectEnabled
    Wscript.Echo "Gues OS: " & objVM.GuestOS
    Wscript.Echo "Has MMX: " & objVM.HasMMX
    Wscript.Echo "Has SSE: " & objVM.HasSSE
    Wscript.Echo "Has SSE2: " & objVM.HasSSE2
    Wscript.Echo "Keyboard: " & objVM.Keyboard
    Wscript.Echo "Memory: " & objVM.Memory
    Wscript.Echo "Mouse: " & objVM.Mouse
    Wscript.Echo "Name: " & objVM.Name
    Wscript.Echo "Notes: " & objVM.Notes
    Wscript.Echo "Processor speed: " & objVM.ProcessorSpeed
    Wscript.Echo "Run as defined account: " & objVM.RunAsDefinedAccount
    Wscript.Echo "Saved state file path: " & objVM.SavedStateFilePath
    Wscript.Echo "Shutdown action on quit: " & objVM.ShutdownActionOnQuit
    Wscript.Echo "State: " & objVM.State
    Wscript.Echo "Undoable: " & objVM.Undoable
    Wscript.Echo "Undo action: " & objVM.UndoAction
    Wscript.Echo
Next
	

List Guest Operating System Information for a Virtual Machine


Lists the Guest operating system information for a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")

Set objGuestOS = objVM.GuestOS
Wscript.Echo "Additions version: " &  objGuestOS.AdditionsVersion
Wscript.Echo "Can shut down: " &  objGuestOS.CanShutdown
Wscript.Echo "Heartbeat percentage: " &  objGuestOS.HeartbeatPercentage
Wscript.Echo "Is heart beating: " &  objGuestOS.IsHeartbeating
Wscript.Echo "Is host time synchronization enabled: " & _
    objGuestOS.IsHostTimeSyncEnabled
Wscript.Echo "OS name: " &  objGuestOS.OSName
	

List Virtual Machine Keyboard Information


Lists keyboard information for all the virtual machines on a computer.
On Error Resume Next

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

For Each objVM in colVMS
    Set objKeyboard = objVM.Keyboard
    Wscript.Echo objVM.Name
    Wscript.Echo "Has exclusive access: " & objKeyboard.HasExclusiveAccess
    Wscript.Echo
Next
	

List Virtual Machine Mouse Information


Lists mouse information for all the virtual machines on a computer.
On Error Resume Next

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

For Each objVM in colVMS
    Set objMouse = objVM.Mouse
    Wscript.Echo objVM.Name
    Wscript.Echo "Horizontal position: " & objMouse.HorizontalPosition
    Wscript.Echo "Scroll wheel position: " & objMouse.ScrollWheelPosition
    Wscript.Echo "Using absolute coordinates position: " & _
        objMouse.UsingAbsoluteCoordinatesPosition
    Wscript.Echo "Vertical position: " & objMouse.VerticalPosition
    Wscript.Echo
Next
	

List Virtual Machine Parallel Port Information


Lists parallel port information for all the virtual machines on a computer.
On Error Resume Next

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

For Each objVM in colVMS
    Set colPorts = objVM.ParallelPorts
    For Each objPort in colPorts
        Wscript.Echo "Virtual machine: " & objVM.Name
        Wscript.Echo "Name: " & objPort.Name
        Wscript.Echo
    Next
Next
	

List Virtual Machine Serial Port Information


Lists serial port information for all the virtual machines on a computer.
On Error Resume Next

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

For Each objVM in colVMS
    Set colPorts = objVM.SerialPorts
    For Each objPort in colPorts
        Wscript.Echo "Virtual machine: " & objVM.Name
        Wscript.Echo "Connect immediately: " & objPort.ConnectImmediately
        Wscript.Echo "Name: " & objPort.Name
        Wscript.Echo "Type: " & objPort.Type
        Wscript.Echo
    Next
Next
	

List Virtual Server Accountant Information


Lists accountant information for all the virtual machines on a computer.
On Error Resume Next

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 "Allowable maximum system capacity: " & _
            colAccountants.AllowableMaximumSystemCapacity
        Wscript.Echo "Allowable reserved system capacity: " & _
            colAccountants.AllowableReservedSystemCapacity
        Wscript.Echo "CPU utilization: " & colAccountants.CPUUtilization

        i = 1
        Wscript.Echo "CPU utilization history:"
        For Each intCPUUtilization in colAccountants.CPUUtilizationHistory
            Wscript.Echo vbTab & i & " -- " & intCPUUtilization
            i = i + 1
        Next

        Wscript.Echo "Disk bytes read: " & colAccountants.DiskBytesRead
        Wscript.Echo "Disk bytes written: " & colAccountants.DiskBytesWritten
        Wscript.Echo "Host disk utilization: " & _
            colAccountants.HostDiskUtilization
        Wscript.Echo "Host memory utilization: " & _
            colAccountants.HostMemoryUtilization
        Wscript.Echo "Maximum system capacity: " & _
            colAccountants.MaximumSystemCapacity
        Wscript.Echo "Network bytes received: " & _
            colAccountants.NetworkBytesReceived
        Wscript.Echo "Network bytes sent: " & colAccountants.NetworkBytesSent
        Wscript.Echo "Relative weight: " & colAccountants.RelativeWeight
        Wscript.Echo "Reserved system capacity: " & _
            colAccountants.ReservedSystemCapacity
        Wscript.Echo "Uptime: " & colAccountants.Uptime
        Wscript.Echo
Next
	

List Virtual Server Display Information


Lists display information for all the virtual machines on a computer.
On Error Resume Next

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

For Each objVM in colVMS
    Set objDisplay = objVM.Display
    Wscript.Echo objVM.Name
    Wscript.Echo "Height: " & objDisplay.Height
    Wscript.Echo "Video mode: " & objDisplay.VideoMode
    Wscript.Echo "Width: " & objDisplay.Width
    Wscript.Echo
Next
	

List Virtual Server Host Information


Lists Virtual Server host computer information.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objHost = objVS.HostInfo

Wscript.Echo "Logical processor count: " & objHost.LogicalProcessorCount
Wscript.Echo "Memory: " & objHost.Memory
Wscript.Echo "Memory available: " & objHost.MemoryAvail
Wscript.Echo "Memory available string: " & objHost.MemoryAvailString
Wscript.Echo "Memory total string: " & objHost.MemoryTotalString
Wscript.Echo "MMX: " & objHost.MMX
Wscript.Echo "Operating system: " & objHost.OperatingSystem
Wscript.Echo "OS major version: " & objHost.OSMajorVersion
Wscript.Echo "OS minor version: " & objHost.OSMinorVersion
Wscript.Echo "OS service pack string: " & objHost.OSServicePackString
Wscript.Echo "OS version string: " & objHost.OSVersionString
Wscript.Echo "Parallel port: " & objHost.ParallelPort
Wscript.Echo "Physical processor count: " & objHost.PhysicalProcessorCount
Wscript.Echo "Processor features string: " & objHost.ProcessorFeaturesString
Wscript.Echo "Processor manufacturer string: " & _
    objHost.ProcessorManufacturerString
Wscript.Echo "Processor speed: " & objHost.ProcessorSpeed
Wscript.Echo "Processor speed string: " & objHost.ProcessorSpeedString
Wscript.Echo "Processor version string: " & objHost.ProcessorVersionString
Wscript.Echo "SSE: " & objHost.SSE
Wscript.Echo "SSE2: " & objHost.SSE2
Wscript.Echo "3DNow!: " & objHost.ThreeDNow
Wscript.Echo "UTC time: " & objHost.UTCTime
	

List Virtual Server Properties


Lists configuration settings for Virtual Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")

Wscript.Echo "Available system capacity: " & objVS.AvailableSystemCapacity
Wscript.Echo "Default additions path: " & objVS.DefaultAdditionsPath
Wscript.Echo "Default VM configuration path: " & _
    objVS.DefaultVMConfigurationPath
Wscript.Echo "Default VN configuration path: " & _
    objVS.DefaultVNConfigurationPath
Wscript.Echo "Disk image search paths: " & objVS.DiskImageSearchPaths
Wscript.Echo "Existing configuration paths: " & _
    objVS.ExistingConfigurationPaths
Wscript.Echo "Maximum floppy drives per VM: " & objVS.MaximumFloppyDrivesPerVM
Wscript.Echo "Maximum memory per VM: " & objVS.MaximumMemoryPerVM
Wscript.Echo "Maximum network adapters per VM: " & _
    objVS.MaximumNetworkAdaptersPerVM
Wscript.Echo "Maximum number of IDE buses: " & objVS.MaximumNumberOfIDEBuses
Wscript.Echo "Maximum nmber of SCSI controllers: " & _
    objVS.MaximumNumberOfSCSIControllers
Wscript.Echo "Maximum parallel ports per VM: " & _
    objVS.MaximumParallelPortsPerVM
Wscript.Echo "Maximum serial ports per VM: " & objVS.MaximumSerialPortsPerVM
Wscript.Echo "Minimum memory per VM: " & objVS.MinimumMemoryPerVM
Wscript.Echo "Name: " & objVS.Name
Wscript.Echo "Product ID: " & objVS.ProductID
Wscript.Echo "Script search paths: " & objVS.ScriptSearchPaths
Wscript.Echo "Suggested maximum memory per VM: " & _
    objVS.SuggestedMaximumMemoryPerVM
Wscript.Echo "Uptime: " & objVS.Uptime
Wscript.Echo "Version: " & objVS.Version
Wscript.Echo "VMRC admin address: " & objVS.VMRCAdminAddress
Wscript.Echo "VMRC admin port number: " & objVS.VMRCAdminPortNumber
Wscript.Echo "VMRC authenticator: " & objVS.VMRCAuthenticator
Wscript.Echo "VMRC enabled: " & objVS.VMRCEnabled
Wscript.Echo "VMRC encryption certificate: " & objVS.VMRCEncryptionCertificate
Wscript.Echo "VMRC encryption certificate request: " & _
    objVS.VMRCEncryptionCertificateRequest
Wscript.Echo "VMRC encryption enabled: " & objVS.VMRCEncryptionEnabled
Wscript.Echo "VMRC idle connection timeout: " & objVS.VMRCIdleConnectionTimeout
Wscript.Echo "VMRC idle connection timeout enabled: " & _
    objVS.VMRCIdleConnectionTimeoutEnabled
Wscript.Echo "VMRC X-Resolution: " & objVS.VMRCXResolution
Wscript.Echo "VMRC Y-Resolution: " & objVS.VMRCYResolution
	

List Virtual Server Support Driver Information


Lists information about support drives for Virtual Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
set colDrivers = objVS.SupportDrivers

For Each objDriver in colDrivers
    Wscript.Echo "Date: " & objDriver.Date
    Wscript.Echo "Description: " & objDriver.Description
    Wscript.Echo "Manufacturer: " & objDriver.Manufacturer
    Wscript.Echo "Provider: " & objDriver.Provider
    Wscript.Echo "Type: " & objDriver.Type
    Wscript.Echo "Version: " & objDriver.Version
    Wscript.Echo
Next
	

List Virtual Server Security Information


Lists security information for Virtual Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objSecurity = objVS.Security

Wscript.Echo "Group name: " & objSecurity.GroupName
Wscript.Echo "Group SID: " & objSecurity.GroupSID
Wscript.Echo "Owner name: " & objSecurity.OwnerName
Wscript.Echo "Owner name: " & objSecurity.OwnerSID
	

List Virtual Server Tasks


Lists all current Virtual Server tasks.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
set colTasks = objVS.Tasks

For Each objTask in colTasks
     Wscript.Echo "Description: " & objTask.Description
     Wscript.Echo "ID: " & objTask.ID
     Wscript.Echo "Is cancellable: " & objTask.IsCancelable
     Wscript.Echo "Is complete: " & objTask.IsComplete
     Wscript.Echo "Percent completed: " & objTask.PercentCompleted
     Wscript.Echo "Result: " & objTask.Result
     Wscript.Echo 
Next
	

Modify a Virtual Machine Property


Modifies the Notes property for a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")

objVM.Notes = "This is a Windows 2000 virtual machine."
	

Modify Virtual Machine Scheduling Parameters


Modifies the scheduling parameters for a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")

Set objAccountant = objVM.Accountant
errReturn = objAccountant.SetSchedulingParameters(99,99,99)
	

Modify Virtual Server Display Dimensions


Modifies the display dimensions for a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")

Set objDisplay = objVM.Display
errReturn = objDisplay.SetDimensions(800,600)
	

Pause a Virtual Machine


Pauses a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")
objVM.Pause()
	

Resume a Virtual Machine


Resumes a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")
objVM.Resume()
	

Register a Virtual Machine


Registers a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
errReturn = objVS.RegisterVirtualMachine("Windows 2000 Server", _
    "C:\Virtual Machines")
	

Return Virtual Machine Mouse Button Status


Returns mouse button status for a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")

Set objMouse = objVM.Mouse
errReturn = objMouse.GetButton(1)
Wscript.Echo errReturn
	

Save the Virtual Machine State


Saves a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")

errReturn = objVM.Save()
	

Shut Down the Guest Operating System on a Virtual Machine


Shuts down a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")

Set objGuestOS = objVM.GuestOS
objGuestOS.Shutdown()
	

Search for a Virtual Machine


Locates a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")

Wscript.Echo "File: " & objVM.File
	

Start a Virtual Machine


Starts a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")

objVM.Startup()
	

Turn Off a Virtual Machine


Turns off a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")

objVM.Turnoff()
	

Unregister a Virtual Machine


Unregisters a virtual machine named Windows 2000 Server.
On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows 2000 Server")
errReturn = objVS.UnregisterVirtualMachine(objVM)