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

VIX function to find guest OS volumes

$
0
0

hello

I am trying to find volumes of guest OS is there any function or method in VIX.

Thanks in advance


Cannot execute VIX API command on a Powered On Virtual Machine - vCenter

$
0
0

I cannot execute any VIX API vmrun command once the Virtual Machine is powered on.

 

The setup is a vCenter server with a number of esx hosts.  I can list all virtual machines, and power the machines on, but once the machine is powered on, every vmrun command fails with the error "Cannot open VM: [datastore] VMname/vmname.vmx, There was an error in communication"

 

When executing the vmrun 'start' command from a command prompt, the command does start the Virtual Machine, but it does not return control immediately.  Instead it hangs for a few minutes before returning with the above error.  In other words it appears that as soon as a Virtual Machine is powered on, the vmrun command cannot communicate with the guest VM.  When powered off, I am able to run many vmrun commands such as revertToSnapshot, snapshot, etc.

 

I tried to execute the vmrun command against the specific esx host and this was successful.  Unfortunately, this is not a great option as the Virtual Machines could reside on any number of esx hosts.

 

Has anyone experienced this?  I'm hoping for a solution other than placing groups of vm's that I need to control via VIX on a particular esx host.

 

Thanks,

 

Joe Yankel

Simulate a device status of disconnected in Workstation v.9?

$
0
0

I am trying to find a way to simulate a device status of disconnected in Workstation v.9.  I could probably stop/start the network service inside a guest but I'm looking for something more disruptive.

 

 

Any suggestions how to do that via the VIX API?

 

 

 

Gary

copy file from vco to guest failure?

$
0
0

Hi

 

I am running VCO 5.1 appliance in a vsphere 5.1 environment.

 

I am attempting to write a file to a guest machine. I have tried using both Local Administrator and Domain Administrator credentials but in both instances I receive the following:

 

No permissions on the file for the attempted operation (Workflow:test workflow / Scriptable task (item1)#15)

 

I have tested that I can indeed logon.

I have tested that I can check for a directory.

I have tested that I can create a directory.

 

All work fine. I just can't appear to create the file.

 

I ran proccess mon on the guest when I ran the workflow (outputprocmon.txt)

 

So I can see it is trying look at the directory and the file but for some reason is getting a permission denied??

 

I can log onto the guest as either a domain admin or local admin and create a file in this directory.

 

Is the file being created as the user passed through or as the account running the vmtools?

 

Test script is:

 

parameters [string]userName, [secureString]password, [VC:VirtualMachine]vm

 

var host = vm.sdkConnection;
var guestOperationsManager = host.guestOperationsManager;
var guestAuth = new VcNamePasswordAuthentication();
guestAuth.username = userName;
guestAuth.password = password;
var fileManager = guestOperationsManager.fileManager;
myResult = false;
overwrite = false;
var attr = new VcGuestFileAttributes();
//var srcFile = new File(vcoPath);
var srcFile = "/scripts/blah.txt";
var guestFilePath = "C:/bin/blah.txt";
var uri = fileManager.initiateFileTransferToGuest(vm , guestAuth ,guestFilePath, attr, srcFile.length, overwrite);
myResult = fileManager.putFile(srcFile, uri);
System.log("Result is: " + myResult);

 

 

Oh and the path /scripts on the vco appliance is a ntfs mount rw,hard,intr

 

Any assistance greatly appreciated.

 

Sam

vmrun fails on ESXi 4.1

$
0
0

I need to use only one simple command, but it unfortunately ends up with error on ESXi 4.1. The command is:

 

vmrun -T esx -h "https://x.x.x.x/sdk" -u root -p ****** stop "[Datastore] New Virtual Machine/New Virtual Machine.vmx"

Error: The virtual machine is not powered on: New Virtual Machine/New Virtual Machine.vmx

 

I tried these builds: VIX API 1.10 Beta, VIX API 1.8.1, VIX API 1.6.2 each without success

On ESXi 4.0 was everything fine and VM is really powered on

 

Can anybody help?

Problem with VixVM_InstallTools

$
0
0

Hi there,

 

I am using a the standard function given in the ViX API for installing tools.

The problem I am facing is the code simply hangs endlessly at VixJob_Wait function and I need to manually end the debug.

Also when I tried the VixVM_LoginInGuest before installing the tools, it again took an aweful lot of time before finally the specifying the tools not installed error(3016).

 

In case the tools need to be installed manually, from where do i need to install them? Also what are all these tools?

 

Anyone please suggest me a solution to work around this problem.

 

I am using Workstation 6.0 and SUSE  and Red Hat Linux images.

C# Wrapper Class

$
0
0

Has anyone created a C# wrapper class for the VIX.DLL?  Would they be willing to share with the community?

 

Thanks.

Virtual machine hard disk size

$
0
0

Does the VIX API provide any means of determining the hard-disk size associated with a given virtual machine? The VMware Server and Workstation consoles have this information so clearly it is available somewhere.


VMW Workstation Scrited VM

$
0
0

 

Alrighty then, I would like to know if it is possible to automate the creation of a VM in VMW Workstation via the VIX API tools. I am talking about from scratch creating a VM. Please do not laugh to hard. I have been looking for info on this, and just have not been able to find it. I am completely new to using the api, as I just downloaded it and have never messed with it before.

 

 

Anyways, I will continue to look, and if I find anything I will post what I find here. Thanks for any help.

 

 

Fishing_Geek

 

 

ViX to Server connection problems. - "The system returned an errror..."

$
0
0

 

Hi

 

 

I've got VMware Server 2.0.0 (b116503) and I'm trying to talk to it through VIX COM 1.6.1.4558 with .NET interop to C#. The server is running on Windows XP Pro and so is the remote machine I'm trying to connect from. It works when I try doing it locally but fails when I try remotely.

 

 

I am supplying a fully qualified name ("http://xxx.xxx.xxx:8222/sdk" and I'm trying something as simple as connecting and powering on.When I run this on the machine local to the Server installation, it works fine. When I try to run it from a remote machine across the network, it's failing.When I call Connect I get error code 16: "The system returned an error. Communication with the virtual machine may have ben interrupted".

 

 

For clarification, I am able to use the web interface from the remote machine so it's not a connectivity or hostname resolution issue. I'm using exactly the same code to connect from the remote as from the local machine. Firewalls are not in place on either machine.

 

 

Any ideas? Have people come across this problem or something like it?

 

 

Many thanks

 

 

Joe

 

 

 

 

 

LoginInGuest() issue with VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT option

$
0
0

 

Hi,

 

I'm having problem with the LoginInGuest() function when using the VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT option. Here's the code written in C#:

 

jobHandle = vmHandle.LoginInGuest(guestUser, guestPassword, Constants.VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT, null); vixError = jobHandle.WaitWithoutResults(); if (vixLib.ErrorIndicatesFailure(vixError)) { throw new VMRobotException("Error when logging on to guest OS. Error code: " + vixError); }

 

every time this is run, it returns error code 3034 VIX_E_INTERACTIVE_SESSION_NOT_PRESENT (The specified guest user must be logged in interactively to perform this operation.) Any one help please?

 

 

BTW, I'm using VIX 1.6.

 

 

 

 

 

Thanks!

 

 

Query tools service from within guest OS

$
0
0

Is the VIX API the right tool to use to query the tools service from within the guest OS?  I've got a friend who wants to find out the host server of his VMs--from the VM.  I told him to try and do it from the server side because that's my expertise, but that's a no-go for some reason.

 

If VIX isn't the answer, anyone know if this can be done otherwise?






[vExpert|http://www.vmware.com/communities/vexpert/], PowerShell MVP, VI Toolkit forum moderator

Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org

Snapshot bug in VIX 1.6.2?

$
0
0

Hello: Trying to determine if this is a VIX 1.6.2 bug, something that I am doing incorrectly in my code or not doing in my code.

I’m running on ESX Server 3i, 3.5.0, Build 123629.

Appreciate any help, suggestions, feedback.

 

What I am seeing is that, if a snapshot is taken for a gueston a different host than it was originally registered to and that guest is moved back to the original host, that new snapshot gets lost at least to the library. In this case, moved means "unregistered/registered" from one host to another.

 

This is the example (in this case guest is on a NAS, accessible by both host0 and host1):

 

Register guest (powered off, no snapshot) on host0, unregister from host0, register on host1, power up guest take snapshot of guest while registered on host1, poweroff guest, unregister from host1, register on host0 and try to revert guest to the snapshot (created while registered on host1) on host0 <--- this last step fails, the RevertToSnapshot API call returns a VIX_E_OBJECT_NOT_FOUND.

 

If instead of doing a revert step above, I try to find the created snapshot, using API calls such as GetCurrent, GetNamedSnapshot, even GetRootSnapshot if that snapshot turned out to be the only snapshot created in this instance, VIX cannot find it – returns invalid handle value. The snapshot does show up in the Snapshot Manager window on VI Client.

Note, if the application is restarted, the snapshots are found when the guest is registered on host0, but the application in which this

is happening is a long-lived application that is not stopped and restarted.

 

 

Thanks in advance.

Long delays in opening a VM

$
0
0

When I call VixJob_Wait on a job handle from VixVM_Open, it can take as much as 25 minutes to actually complete.

 

Here's the relevant code (error checking & variable declarations removed for clarity - nothing returns an error code other than VIX_OK.)

 

jobHandle = VixHost_Connect( VIX_API_VERSION, VIX_SERVICEPROVIDER_VMWARE_VI_SERVER, "http://localhost:8222/sdk", 0, "username", "password", 0, VIX_INVALID_HANDLE, NULL, NULL );

VixJob_Wait( jobHandle, VIX_PROPERTY_JOB_RESULT_HANDLE, hostHandle, VIX_PROPERTY_NONE );

Vix_ReleaseHandle( jobHandle );

jobHandle = VixVM_Open( hostHandle, "[standard] pathTo/theVM.vmx", NULL, NULL );

// And this next line is where I have problems: if I'm lucky, it returns in about five minutes; if not, it can take as much as about 25 minutes to return.

VixJob_Wait( jobHandle, VIX_PROPERTY_JOB_RESULT_HANDLE, vmHandle, VIX_PROPERTY_NONE );

// Etcetera - once I actually have the vmHandle, the rest of my program completes in a timely fashion.

 

I'm using VMware Server version 2.0.0 (build 122589), running on a 64 bit Ubuntu 8.0.4 host.  I've tried using the vix libraries that came with VMware Server; I've tried using the 1.6.2 libraries that I downloaded separately (version 2.0.0 build 127388) - I get the same results with both.

 

Now for the interesting part: If I go in by hand and use the vmrun command line utility - it works with no delay whatsoever.  For example,

vmrun -T server -h http://localhost:8222/sdk -u username -p password revertToSnapshot "[standard] pathTo/theVM.vmx"

 

Also, if I watch the VM I'm working with in the VI web interface, I see a task go past: "Find Virtual Machine By Datastore Path" - in the case of using vmrun, this triggers and completes immediately.  In the case of my code, the VI interface shows this task as being triggered at a time just before my call to VixJob_Wait actually returns - and it completes immediately once it's actually triggered.

 

Does anyone have any ideas as to what could be causing this behavior, or how I can fix it?

(Aside from the obvious of just piping everything I do through vmrun, which is inconvenient at best.  I'm using the VIX API so I can actually block until certain tasks are actually finished, which is not a behavior that - to my knowledge - the vmrun command supports.)

Modify Disk Mounting Options from VIX

$
0
0

 

Hello

 

 

Is it possible to modify the iso file mounted to a VM with VIX? If so, what function would I use for that?

 

 

Billy3

 

 


Enumerate VMs with basic performance properties

$
0
0

Hi,

 

Is there sample code available that shows how to enumerate virtual machines, and get their basic performance properties (e.g. memory usage, CPU usage, network usage)?

 

Is this even possible? After glancing through the API, I didn't find a way to get the current CPU usage for example. I'd like to do all this in C.

 

 

Thank you for any hints

Unable to run the Sample Perl Script

$
0
0

 

Hi,

 

 

Im attempting to create myself a PHP/Perl Script. and i have no idea where to start, so i started to look at the Perl script but i cant get it to run i get the following error.

 

 

 

 

 

root@mars /usr/lib/vmware-vix/vix-perl/samples# perl findhosttest.pl

Can't locate VMware/Vix/Simple.pm in @INC (@INC contains: blib/lib blib/auto blib/arch blib/arch/auto/VMware blib/arch/auto /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at findhosttest.pl line 17.

BEGIN failed--compilation aborted at findhosttest.pl line 17.

 

 

Any Suggestions?

 

 

 

 

 

Regards,

 

 

Chris English

 

 

ntdll crash

$
0
0

Anybody had ntdll.dll problems while using VIX C API?

 

I don't know for sure my problem is caused by VIX. I have a java application that uses the VIX API through JNI. A few times, while it was running a crash occured. One of those Windows XP generic error dialogs. I looked in the Event Viewer and found the following error message:

 

Faulting application java.exe, version 6.0.110.3, faulting module ntdll.dll, version 5.1.2600.3520, fault address 0x000108d3.

 

Sometimes it happened soon after starting the application, another it happened after it ran for quite some time. I couldn't localize it to any specific operation.

 

Do you think this could be caused by VIX?

CopyFileFromHostToGuest - INTERNAL ERROR: A file was not found

$
0
0

Hey, I am trying to Copy files into a VMWare image hosted in ESX using VIX (C# Wrapper around the COM API), but I can't quite get it right.

 

Conceptual Something like:

 

IVMWareVirtualHost host = new VMWareVirtualHost();

host.ConnectToVMWareVIServer("172.18.19.69", "ESX Admin User", "ESX Admin Password");

 

IVMWareVirtualMachine virtualMachine = host.Open("[Storage1] Image/Image.vmx");

virtualMachine.PowerOn();

virtualMachine.WaitForToolsInGuest();

virtualMachine.LoginInGuest("Administrator", "ILoveOMSIS!1234");

virtualMachine.CopyFileFromHostToGuest("C:
temp
File.txt", "C:
package
File.txt");

 

And it fails at the last line with "INTERNAL ERROR: A file was not found"...

 

The File exists Locally, Casing is corrent and the "C:\package" folder exists in the Guest.

 

Host System: ESX 4.0

Guest System: Windows XP

Client System: Windows 2003 server

 

(Client System refers to the system where I try tu run the commands and vmrun.exe

 

After trying to find some help ect on the web, I went to "vmrun" and tested a command that used to work with the "VMWare Server"

 

vmrun -T server -h https://localhost:8333/sdk -u "Local Admin User" -p "Local Admin Password" -gu "Guest Admin account" -gp "Guest Admin password" CopyFileFromHostToGuest "[Standard] Image/Image.vmx" "C:\temp\file.txt" "C:\package\file.txt"

 

changed to:

 

vmrun -T server -h https://172.18.19.69/sdk -u "ESX Admin User" -p "ESX Admin Password" -gu "Guest Admin account" -gp "Guest Admin password" CopyFileFromHostToGuest "[Storage1] Image/Image.vmx" "C:\temp\file.txt" "C:\package\file.txt"

 

Both Works just fine...

 

So what am I'm doing wrong in the code?

Newbie to VIX API coding (and other .dlls I see floating around)

$
0
0

I have been doing .vbs (adsi/wmi) scripting for years and now want to get into VMware coding via the VMware APIs & DLLs.

 

The I saw Eric Sloof's VS 2010 VB project using dll, for his VMclient (ie easy remote console) applcation. But, I have no idea where he got these DLLs from, or how they are used. This can be dowloaded at http://vmclient.nl/ (right most is a 2010 project, inside there you can find the folowing DLLs:

 

 

Interop.VMwareRemoteConsoleTypeLib.dll

AxInterop.VMwareRemoteConsoleTypeLib.dll

VimService2005.dll

 

 

I have seen the homebrew dll wrappers which look like the conenct to the VC web service via SOAP. As it seems the VMware API only works w/ Java and C#. It seems use some older Vmwre dlls so Richard Garsthagen wrote a wapper, which seems to give full serialize support to the SOAP agent on the VC server. Eric Sloof r'cmd grabbing and using the DLLs from http://www.run-virtual.com/?page_id=173 when I browse the DLL in Visual Studio i see tons and tons of stuff (fun!) but it seems so complex.  The .pdf that pointed me to this is also by Eric Sloof and is here:  http://www.ntpro.nl/VMwareVBApp.pdf

 

 

IN addition, I have seen the VMware published DLL in (VIX API bet 1.10 -- http://www.vmware.com/support/developer/vix-api// ) from VMware but only lets you hook and do stuff on a VM. It appear to let you do stuff on the host or cluster level. Is thie correct it only lets you do stuff on the VM and not the host/cluster? Using this API Eric Sloof shows how to connect, power on/off a VM, and move files a VM it w/o the NIC in this example. His video is here: http://www.ntpro.nl/blog/categories/22-Products Sickly, I screen shot his video and typed in ALL the code (yeah a bit like the C64 days) and am playing this this code sample. If he agrees, I can post his source code.

 

 

Can anybody shed some light on this? Is VMware working on like a "gold ticket API" which we can hook and do everything (connect to VM consoles, move file to/from VMs, Automate VirutalCenter,etc etc) ? I do perfer to use VB .net (due to my .vbs scripting background). This is very confusing to a new coder and there seems to be a ton of DLLs all over the place and I am not sure where they came from.

 

 

Thanks.

Viewing all 34639 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>