Name
UnregisterVM
Description
HRESULT
UnregisterVM([in] BSTR vmxFilePath,
[in] ICallback* jobDoneCallback,
[out,retval] IJob** unregisterJob);
This
method
removes a virtual machine from the host's inventory.
Parameters
- vmxFilePath
-
The path name of the .vmx file on the host.
- jobDoneCallback
-
An ICallback instance that will be called when the
operation is complete.
- unregisterJob
-
Returns an IJob object that describes the state of this
asynchronous operation.
Return Value
HRESULT
Remarks
- This
method
removes a virtual machine from the local host's inventory.
The virtual machine is identified by the vmxFilePathName, which is a path
name to the configuration file (.VMX file) for that virtual machine.
- The format of the path name depends on the host operating system. If the
path name includes backslash characters, you need to precede each one
with an escape character.
- This
method
does not apply to Workstation, which has no virtual machine
inventory.
- This method is asynchronous. Completion is reported by a IJob object.
Side Effects
None.
Requirements
VixCOM.h, since VMware Workstation 6.0.
Example
VBScript:
Dim lib
Dim err
Dim job
Dim host
Dim results
Set lib = CreateObject("VixCOM.VixLib")
Set results = Nothing
Set job = lib.Connect(VixCOM.Constants.VIX_API_VERSION, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_SERVER, Empty, 0, Empty, Empty, 0, Nothing, Nothing)
err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), results)
If lib.ErrorIndicatesFailure(err) Then
' Handle the error...
End If
Set host = results(0)
Set job = host.UnregisterVM("c:\Virtual Machines\vm1\win2000.vmx", Nothing)
err = job.WaitWithoutResults()
If lib.ErrorIndicatesFailure(err) Then
' Handle the error...
End If
Copyright (C) 2007 VMware, Inc. All rights reserved.