Quantcast
Channel: VMware Communities : Popular Discussions - VIX API
Viewing all 34639 articles
Browse latest View live

VMWareTasks 1.2 (let's reinvent less wheels)

$
0
0

Update: VMWareTasks 1.2 has been officially released. Click here to download.

 

-


 

VMWareTasks 1.2 RC1 is now available. VMWareTasks is a synchronous VixCOM .NET wrapper and an add-on library for common VMWare VixCOM API tasks. There're some really exciting features in 1.2 that will save you tons of time, including support for fetching logged-in user environment variables and mapping VMWare Windows Guest OS network resources (net use file://
ip\drive$
). Give it a try!

 

 

In this version:

 

 

 

 

  • Completed VixCOM API full support.

    • 1626: VMWareVirtualHost.Register and Unregister.

    • 1631: VMWareVirtualMachine.InstallTools.

    • 1629: VMWareVirtualMachine.Snapshots.Enabled.

    • 1630: VMWareVirtualMachine.GetFileInfoInGuest.

    • 2688: VMWareVirtualMachine.Clone and VMWareSnapshot.Clone.

    • 2691: VMWareVirtualMachine.Delete.

    • 1628: VMWareVirtualMachine.BeginRecording and EndRecording, VMWareSnapshot.BeginReplay and EndReplay.

    • 1633: VMWareVirtualMachine.Reset, Suspend, Pause, UnPause, IsPaused and IsSuspended.

    • 1913: VMWareVirtualHost.IsConnected.

    • 1634: VMWareVirtualMachine.RunScriptInGuest.

    • 1632: VMWareVirtualMachine.OpenUrlInGuest.

    • 1635: VMWareVirtualMachine.UpgradeVirtualHardware.

  • Added an optional VMWareTools package built on top of VMWareLib that implements additional common VMWare tasks.

    • VMWareLib.Tools.GuestOS.IpAddress: guest operating system IP address information.

    • VMWareLib.Tools.GuestOS.ReadFile, ReadFileLines and ReadFileBytes: read remote files as binary data or text with encoding support.

    • 2232: VMWareLib.Tools.Windows.Shell.GetEnvironmentVariables: obtain logged-in user environment.

    • VMWareLib.Tools.Windows.Shell.RunCommandInGuest: runs commands and collect console output.

    • VMWareLib.Tools.Windows.MappedNetworkDrive: maps guest operating system network resources.

  • Backwards incompatible interface changes.

    • VMWareVirtaulMachine.PowerOn no longer calls WaitForRenamed VMWareVirtualMachine.Login into LoginInGuest and renamed VMWareVirtualMachine.Logout to LogoutFromGuest to be consistent with VIX COM API and allow power-on without tools installed.

  • Misc improvements.

    • Added VMWareVirtualMachine.ShutdownGuest and PowerOff that allow specifying shutdown parameters explicitly.

    • Added support for VMWare Server with VMWareVirtualMachine.ConnectToVMWareServer.

    • Exposed a VMWareVirtualMachine.LoginInGuest function with power options.

    • Lots of new documentation with examples.

  • Bugs.

    • GetNamedSnapshot behaves differently on Workstation and VI, now throws exception when snapshot not found. Use FindSnapshotByName to get a null result when the snapshot doesn't exist.

    • KillProcessInGuest unit test needs to wait for process to actually die according to VMWare docs.

    • Removing a shared folder doesn't remove it from the collection when not the same object.

    • Fixed different behavior of ListDirectoryInGuest between Workstation and VI.

    • API-level errors aren't surfaced and the callback wait will never be set when VixCOM is not installed.

 


runProgramInGuest and Program Exit Codes

$
0
0

 

I am using vmrun 6.5.2 to run a testing tool in the guest. Using vmrun I first start a VM and then the testing tool. My testing tool returns an exit code that I would like to be able to check. Is that possible?

 

 

 

 

 

Where could i get a beta version?

there is a way to obtain, CPU and Memory usage from the virtual Machine

$
0
0

 

there is a way to obtain, CPU and Memory usage from the virtual Machine usink Vix Api.

 

 

Regards.

 

 

I'm using  C# wrapper.

 

 

Get Configuration Info within GuestOS

$
0
0

 

Hi there,

 

 

I am running VMWare Server and using VIX Toolkit for Windows. I have created a virtual machine in VMWare Server by the name 'VM1'. In that, I have installed Wndows Server 2003.

 

 

I want to make an application in C# .NET 2.0 that I can run within the guest OS of VM1 which can get me its Location ID. For this, I am currently trying to retrieve:

 

 

VMware.Vim.VirtualMachine.Config.LocationId

 

 

Any help in this mattar will be greatly appriciated

 

 

Exception:System.Runtime.InteropServices.COMException (0x80010105)

$
0
0

 

Hi , guys.I'm a newbie about VM.

 

 

  I work with Vestris.VMWareLib1.4  in VS.Net2008.

 

 

I want  to  make a windows form app to control VMWare  Workstation7.0 and VMWare Server2.0.   The workstation has been installed in localhost  and the Server in the other computer(192.168.0.53) on which WinXP OS runs.  In my codes, I use ListBox control to list the workstation's name and the server's name. When user selects one item in the listbox,  the app will automaticly connect to  the according host.       Some code:

 

 

VMWareVirtualHost host=new VMWareVirtualHost();

 

 

switch (vm_product_type)

{

       case (int)(VMPRODUCTTYPE.Server2):

       #region server2.0

 

 

        string connStr = null;

        if (consolePort != null && consolePort.Length > 0)

        {

                connStr = hostIP + ":" + consolePort;

         }

         else

         {

                connStr = hostIP+ ":8333";

           }

host.ConnectToVMWareVIServer(connStr, account, password, 10);

 

 

            #endregion

            break;

           case (int)(VMPRODUCTTYPE.WorkStation):

host.ConnectToVMWareWorkstation(10);

             break;

            default:

                   breakl;

 

 

}

 

 

:Everytime when user select the other item in the listbox ,I  have  called host. Disconnect() for the previous select  and disposed  the previous host object.

 

 

Problems:

 

 

(1)After the app starts, when user select  the Workstation item ,the app will connect to workstation sucessfully.But after that, when user click the server item,An exception is thrown:

 

 

System.Runtime.InteropServices.COMException (0x80010105): The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))

 

 

at  Interop.VixCOM.VixLibClass.Connect(Int32 apiVersion,Int32 hostType,String hostName,Int32 hostPort,String userName,String password,Int32 options,IVixHandle propertyList,ICallback jobDoneCallback)       

 

 

at Vestris.VMWareLib.VMWareVirtualHost.Connect(ServiceProviderType serviceProviderType,String hostName,Int32 hostPort,String username,String password,Int32 timeout)         

 

 

at Vestris.VMWareLib.VMWareVirtualHost.ConnectToVMWareVIServer(Uri hostUri,String user)name,String password,Int32 timeoutInSeconds

 

 

...........................

 

 

(2)After the app starts,if user click Server item,the app will automaticly connect to the Server sucessfully.But  after that,if user click the Workstation item,the app will throw an exception :

 

 

The procedure entry point gvmoni_session_set_useragent could not be located in the dynamic link library gvmoni.dll.

 

 

 

 

 

so Coulde anyone help me? I have struggled with it for nearly one week.

 

 

Any help will be appreciated. Thanks in advance.

 

 

my email: 424wrl@163.com

 

 

Statically Link Program with libvixallproducts

$
0
0

 

 

 

 

If I statically link my VIX API script will I have to copy the "libvixAllProducts.so" file to my other Linux boxes to run my script?

 

 

With the sample code, I was trying the following, which hasn't work yet...

 

 

thanks,

 

 

h

 

 

 

  1. make all

gcc -static -I/usr/include/vmware-vix suspend.c -o suspend -lvixAllProducts

/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lvixAllProducts

collect2: ld returned 1 exit status

make: *** Error 1

 

 

 

In the make file the following is defined...

 

 

WRAPPER = -lvixAllProducts

SERVER11 = /usr/lib/vmware-vix/lib/server-1/32bit/libvix.so

WORKST60 = /usr/lib/vmware-vix/lib/ws-3/32bit/libvix.so

SERVER20 = /usr/lib/vmware-vix/lib/VIServer-2.0.0/32bit/libvix.so

WORKST65 = /usr/lib/vmware-vix/lib/Workstation-6.5.0/32bit/libvix.so

WRAPORNOT = $(WRAPPER)

VIXH = -I/usr/include/vmware-vix

 

 

 

 

 

 

 

how to config the function RemoteDisplay throuth vnc by vmrun?

$
0
0

 

i'd like to remotely control the virtual machine by vmrun.

 

 

but  i can't make it work the RemoteDisplay throuth vnc all the time with vmrun command.

 

 

here is my cmdline:

 

 

        vmrun -T ws writeVariable <.vmx path>  runtimeConfig RemoteDisplay.vnc.enabled TRUE

 

 

i connect to the virtual machine with my realvncviewer:

 

 

        127.0.0.1:5900

 

 

failed to connect.

 

 

any suggestion?

 

 

Thanks!

 

 

 

 

 

 

 

 


Logging into guest VM failing with error 3015

$
0
0

 

The VIX API call LoginInGuest fails with error code 3015 (<![endif]><![if gte mso 9]><![endif]><![if gte mso 10]>

/* Style Definitions */
table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

Authentication failure or insufficient

permissions in guest operating system). I have checked the user anme and password being used is correct.

 

 

 

 

 

VIX version: 1.6.2

 

 

Guest is running UBuntu 10.04 on ESXi 4 Update 1 (Build 20811)

 

 

 

 

 

Thanks in advance.

 

 

C# Wrapper thowing COM Threading Error

$
0
0

 

Hi,

 

 

I am calling C# Wrapper from a COM and receiving this error

 

 

Unable to cast COM object of type 'VixCOM.VixLibClass' to interface

type 'VixCOM.IVixLib'. This operation failed because the QueryInterface

call on the COM component for the interface with IID

'{94EAA428-2460-470D-8F66-2A4270AFF20A}' failed due to the following

error: The application called an interface that was marshalled for a

different thread. (Exception from HRESULT: 0x8001010E

(RPC_E_WRONG_THREAD))

 

 

Looks like the VixCom is created on the Main Thread and when the main

thread is launching another thread to execute it, this error is thrown. I

can get it to work first time, but this occurs when i run the code

second time from my GUI.

 

Looks like I have to set for some methods or set

ThreadingModel for vixCom to Apartment.

Coffee Talk Webinar: VIX API Managing and Automating your Guest Wed June 30th 9:00 AM PST

$
0
0

Thanks for Joining this mornings Coffee Talk - PDF and MP3 Link

 

Link to MP3 -> http://blogs.vmware.com/files/vix-api.mp3

 

Title: VIX APIs - Managing and Automating Guest OS

We will show examples of how the VIX API can be used to develop tools for managing guest environments in VMware products. Included will be a demonstration of proof-of-concept tools that monitor processes and transfer files to multiple guests simultaneously. We will also show a Perl script that combines vSphere Web Services SDK and VIX SDK to re-size a virtual disk and then the filesystem above it on the fly.

Speaker: Matt Lamantia R&D Manager

Level: Advanced

how to handle Unicode string in vix c api?

$
0
0

 

vix c api handle all string as char*, but sometime when the path of vmx file is unicode, vix can not work. so does vix c api support wide character?

 

 

path to virtual machines

$
0
0

Hi

 

I use FindItems to get virtual machines. It gaves me a result like /Virtual Machines/Virtual Machine #1 I can Open the VM with this path but I need the phisical path. How can I get the path to the virtual machines.

 

Thanks in advance!

IP address of guest OS (VIX API)

$
0
0

Is there a way to figure out the IP address of guest OS in the VM, using VIX API. I did notice in a couple of discussion threads, mention of trying to read VM specific variables using VixVM_ReadVariable method call as:

 

jobHandle = VixVM_ReadVariable(vmHandle,

                               VIX_VM_GUEST_VARIABLE,

                               "ip",  // Name of IP address variable supposed to be populated by VMWare Tools

                               0, // options

                               NULL, // callbackProc

                               NULL); // clientData);

err = VixJob_Wait(jobHandle,

                  VIX_PROPERTY_JOB_RESULT_VM_VARIABLE_STRING,

                  &readValue,

                  VIX_PROPERTY_NONE);

 

readValue gets populated with the IP address (or so it claims) I tried this, but the readValue always shows an empty string ""

Is there a reliable way to retrieve the IP address of the ethernet adaptor on the VM. Help would be appreciated.

VIX and ESXi 4.1 - license issue ?

$
0
0

 

Hi,

 

 

I am new with VIX and try to use it for a proto infrastructure.

When I try to start a VM with VIX (from a VM of the same host) here is what I get :

 

 

vmrun -T esx -h https://bod-qa-vmhost1.vsg3d.intra/sdk -u root -p rootPassword start "[Local Datastore HDD1 VMs] bod-qa-vmbuild2/bod-qa-vmbuild2.vmx"

 

Unable to connect to host.

Error: This operation is not supported with the current license

 

 

I have a free license ESXi, is this the issue ?

 

 

What king of license should I need to make it run ?

 

 

Thanks.

 

 

 

 

 

 

 

 


Vmware-vix 64 bit installation prob - bad interpreter: Permission denied error

$
0
0

 

Hi,

 

 

I'm trying to install vmware-vix 1.10 on Centos 5.4 64bit. I su and validated i'm logged in as root, then launched the installer:

 

 

sh ./VMware-VIX-1.10.1-266898.x86_64.bundle

 

Everytime I get the following bad interpreter: Permission denied error message:

 

-


 

 

# sh ./VMware-VIX-1.10.1-266898.x86_64.bundle

Extracting VMware Installer...done.

./VMware-VIX-1.10.1-266898.x86_64.bundle: /tmp/vmis.YT8332/install/vmware-installer/vmware-installer: /usr/bin/env: bad interpreter: Permission denied

 

 

-


 

 

It's as if the installer get extracted to a temporary directory (in this case /tmp/vmis.YT8332/) but then aborts when it tries to launch.

Has anyone seen this behaviour? 

 

 

When I cd to /tmp the temporary extration directory is already gone, I assuem the scipt deleted it right after the  bad interpreter: Permission denied error

 

 

I've installed the 32bit version of vmware-vix 1.10 bundle on my Ubuntu 10.04 laptop without a problem. Are there any parameters I can pass to the bundle script to troubleshoot? I couldn't  find any documentation about this.  

 

 

 

 

 

 

 

 

WindowXP 64-bit VM doesn't work with VIX API 1.8.1

$
0
0

When I try to run my VIX API callls against a WindowsXP 64-bit system I get the errors below. However, if I run the same calls against WindowsXP 32-bit, it works fine. Is WindowsXP 64bit not supported? Does it have anything to do with the libvix.so type?

 

Loading Vix implementation library /usr/lib/vmware-vix/VSphere-4.0/32bit/libvix.so
Dec 20 13:01:59.750: app-3076457120| unable to load func VixHost_OpenVM from library /usr/lib/vmware-vix/VSphere-4.0/32bit/libvix.so (/usr/lib/libvixAllProducts.so: undefined symbol: VixHost_OpenVM)
Dec 20 13:02:00.156: app-3076457120| No such function 'VixHost_OpenVM' for version 4

LoginInGuest returns a 3034 even using WaitForToolsInGuest

$
0
0

Hello,

 

we have updated our ESX hosts (from 3.5 to 4.1 version) and the VIX API from 10.1 to 10.2. Since then I have a problem when doing LoginInGuest because even using WaitForToolsInGuest I get a 3034 error (VIX_E_INTERACTIVE_SESSION_NOT_PRESENT). I have the same error even putting a 300 seconds delay after the system powers up.

 

MORE INFORMATION: What happened before is that you could call LoginInGuest() even when the login screen was visible at XP. Somehow the system logged in (the login screen still was there) and when you physically logged into the XP all the automatic tasks where running. Now if the login screen is visible at XP we get the 3034.

 

What's the point of having a LoginInGuest if you need to log by hand to be able to call this function????

 

I really don't know what to do ... any help will be great!

VIX APIs are VERY SLOW with VMware Server 2.0.2

$
0
0

I using vix api to automate the VM operations with vmware server.  The  VixHost_RegisterVM, VixHost_OpenVM, VixHost_UnregisterVM are very slow. Each of these functions are taking 8 to 10 mins to complete.

 

The same VIX api programs works perfectly fine with Workstation.

 

Is there any way to figureout the cause?  I think VIX DLLs bundled with VMware server are damn - dman slow. Not sure why ?? I hope some one has faced the same problem.

 

I run VMRUN command, exe comes out in 10-15 sec, but actual registerstration takes lot of time. My API open was taking lot of time.

 

This delay is observered for the first VM registered using VIX. For immediate next VM, it happens in 2-3 min....Any guesses....pointers....

RunProgramInGuest only works if user is already logged in interactively?

$
0
0

I am at a loss on how to use the VIX api or vmrun.exe to run programs in the guest OS. I see proofs of concepts, but never have seen any signifcant, real-life, business case example of this working. I have been through every.VIX api.resource.available.

 

Here are my operations at a high level:

1. power on VM snapshot
2. Run a program. Such as notepad.exe. Ideally, I would like to run an msi package. but keeping it simple for now...
3. shutdown the VM
4. take snapshot
Now - these steps work fine if I first manually log into an already-powered-on snapshot and just start my program in step 2. Everything just works. However, if I start at step 1 and allow VIX to power on the snapshot, my RunProgramInGuest just doesn't do what it normally would had I been logged in already. Same situation occurs for RunScriptInGuest. It seems that unless I am also already logged into the machine with a real, interactive user session, I cannot get the program to run inside the guest.
vmrun -T ws runScriptInGuest -activewindow D:\VMware-VMs\test-W7x86-3\test-W7x86-3.vmx "C:\windows\system32\cmd.exe" "/c C:\users\test\desktop\StartTask.bat"

 

UAC is off on host and guest machine. my user is Administrator. The result of running this command is that I can use listProcessesInGuest and see some new processes running under this username:

pid=2984, owner=MYDOMAIN\test, cmd="C:\Windows\System32\cmd.exe"  "C:\Users\test\AppData\Local\Temp\vixScript0"

pid=2992, owner=MYDOMAIN\test, cmd=\??\C:\Windows\system32\conhost.exe "-262616372-801187394105077478520761067478199601-1762539247384719877-515260550

 

the above is the farthest I can get. runProgramInGuest doesn't even get me this far however...I wouldn't even see the process get kicked off.

 

I have accomplished this goald with virtual box in the past. I moved toward VMWare and find it a much much better product. However this API seems a little more difficult to work.

 

I also raised a similar version of this problem here: http://stackoverflow.com/questions/12335148/unable-to-use-vix-api-to-power-on-vm-install-software-with-msiexec-then-create

Viewing all 34639 articles
Browse latest View live