VMware {code} Community
writetonikhil
Contributor
Contributor

vmregister.pl doesn't work

Hi All,

I have just started exploring the VMware Perl toolkit and I find some intersting sample scripts in it. I am using vmregister.pl script to register a VM in one of my test ESX servers. But I get the following error

C:\Program Files\VMware\VMware VI Perl Toolkit\Perl\samples\vm>perl vmregister.pl --url [https://10.75.121.133/sdk/webService|https://10.75.121.133/sdk/webService] --host "ps6484" --pool Flowers --vmxpath "[Local Datastore]Windows XP Professional" --folder "Lotus" --username root --password xxxxxxxxx Could not find virtual machine folder

End Disconnect

C:\Program Files\VMware\VMware VI Perl Toolkit\Perl\samples\vm>

If I don't give the --folder option I get a syntax error:

C:\Program Files\VMware\VMware VI Perl Toolkit\Perl\samples\vm>perl vmregister.pl --url [https://10.75.121.133/sdk/webService|https://10.75.121.133/sdk/webService] --host "ps6484" --pool Flowers --vmxpath "[Local Datastore]Windows XP Professional" --username root --password xxxxxxx Filtering is only supported for Simple Types at vmregister.pl line 71

End Disconnect

C:\Program Files\VMware\VMware VI Perl Toolkit\Perl\samples\vm>

Am I missing anything? Is the 'Folder' option essential? I can't find a good documentation for vmregister.pl. The available documentation seems to be insufficient.

- Nik

0 Kudos
8 Replies
admin
Immortal
Immortal

No "folder" is not a required option to run the sample, the issue seems to be with the vmxpath you are passing. vmxpath is the path of the vmx location of the virtual machine. There should not be

any space between the datastore and the virtual machine name. For e.g if the actual path of the virtual machine ABC is "[datastore] ABC/ABC.vmx". The vmxpath path

should be "[datastore]ABC/ABC.vmx".

Every Perl utility in VI Perltoolkit contains perldoc, you can run perdoc command to see the related documentation.

lamw
Community Manager
Community Manager

Here is the fix: http://communities.vmware.com/message/1140410#1140410

I guess the sample script doesn't support complex filtering and I too was just looking for the standard "register" feature without having to provided "datacenter, resource pool and folder" params.

=========================================================================

--William

VMware ESX/ESXi scripts and resources at:

writetonikhil
Contributor
Contributor

Hi William,

Thanks for the post. But that too didn't work. Whatever I put in the --vmxpath, it gives "Invalid datastore format" error:

D:\Study Material\Virtualization\VTM Project\VM Experiments\Scripts>perl Register.pl --server 10.77.161.133 --vmxpath "[http://10.77.161.133] Windows XP Professional/winxppro.vmx" Enter username: root Enter password: Folder=HASH(0x3f611bc) Registering VM '[http://10.77.161.133] Windows XP Professional/winxppro.vmx'

SOAP Fault: -


Fault string: Invalid datastore format '[http://10.77.161.133] Windows XP Professional/winxppro.vmx'. Fault detail: InvalidDatastoreFault End Disconnect

D:\Study Material\Virtualization\VTM Project\VM Experiments\Scripts>perl Register.pl --server 10.77.161.133 --vmxpath "[Local Datastore] Windows XP Professional/winxppro.vmx" Enter username: root Enter password: Folder=HASH(0x3f611bc) Registering VM '[Local Datastore] Windows XP Professional/winxppro.vmx'

SOAP Fault: -


Fault string: Invalid datastore format '[Local Datastore] Windows XP Professional/winxppro.vmx'. Fault detail: InvalidDatastoreFault End Disconnect

D:\Study Material\Virtualization\VTM Project\VM Experiments\Scripts>perl Register.pl --server 10.77.161.133 --vmxpath "[http://10.77.161.133|http://10.77.161.133] Windows XP Professional/winxppro.vmx" Enter username: root Enter password: Folder=HASH(0x3f61474) Registering VM '[http://10.77.161.133|http://10.77.161.133] Windows XP Professional/winxppro.vmx'

SOAP Fault: -


Fault string: Invalid datastore format '[http://10.77.161.133|http://10.77.161.133] Windows XP Professional/winxppro.vmx'. Fault detail: InvalidDatastoreFault End Disconnect

D:\Study Material\Virtualization\VTM Project\VM Experiments\Scripts>perl Register.pl --server 10.77.161.133 --vmxpath "[http://10.77.161.133|http://10.77.161.133] Windows XP Professional\winxppro.vmx" Enter username: root Enter password: Folder=HASH(0x3f61474) Registering VM '[http://10.77.161.133|http://10.77.161.133] Windows XP Professional\winxppro.vmx'

SOAP Fault: -


Fault string: Invalid datastore format '[http://10.77.161.133|http://10.77.161.133] Windows XP Professional\winxppro.vmx'. Fault detail: InvalidDatastoreFault End Disconnect

D:\Study Material\Virtualization\VTM Project\VM Experiments\Scripts>perl Register.pl --server 10.77.161.133 --vmxpath "[http://10.77.161.133] Windows XP Professional\winxppro.vmx" Enter username: root Enter password: Folder=HASH(0x3f611bc) Registering VM '[http://10.77.161.133] Windows XP Professional\winxppro.vmx'

SOAP Fault: -


Fault string: Invalid datastore format '[http://10.77.161.133] Windows XP Professional\winxppro.vmx'. Fault detail: InvalidDatastoreFault End Disconnect

D:\Study Material\Virtualization\VTM Project\VM Experiments\Scripts>

Regards,

Nik

0 Kudos
lamw
Community Manager
Community Manager

The modification I made worked on VMware VIMA, make sure you're using the following format when registering your VM:

"[datastore] VM/VM.vmx"

I see that your --vmxpath examples all have the ESX/ESXi server IP which is incorrect. If you're just using the VI Perl Toolkit and not VMware VIMA and VI fast pass, the connection string should be something like this:

Register.pl --server A.B.C.D --username root --password SOME_PASS --vmxpath "[datastore] VM/VM.vmx"

=========================================================================

--William

VMware ESX/ESXi scripts and resources at:

0 Kudos
writetonikhil
Contributor
Contributor

William,

Still no luck! Smiley Sad

D:\Study Material\Virtualization\VTM Project\VM Experiments\Scripts>perl Register.pl --server 10.77.161.133 --vmxpath "[Local Datastore] VMNikhil/VMNikhil.vmx" Enter username: root Enter password: Registering VM '[Local Datastore] VMNikhil/VMNikhil.vmx'

SOAP Fault: -


Fault string: Invalid datastore format '[Local Datastore] VMNikhil/VMNikhil.vmx' Fault detail: InvalidDatastoreFault End Disconnect

D:\Study Material\Virtualization\VTM Project\VM Experiments\Scripts>perl Register.pl --server 10.77.161.133 --username root --password ******* --vmxpath "[datastore] VMNikhil/VMNikhil.vmx" Registering VM '[datastore] VMNikhil/VMNikhil.vmx'

SOAP Fault: -


Fault string: Invalid datastore format '[datastore] VMNikhil/VMNikhil.vmx'. Fault detail: InvalidDatastoreFault End Disconnect

D:\Study Material\Virtualization\VTM Project\VM Experiments\Scripts>

- Nikhil

0 Kudos
admin
Immortal
Immortal

The fault you are receiving is due to incorrect vmxpath. Datastore is retrieved from vmxpath. So you need to be careful. Datastore name should be passed in square brackets as follows:

Correct vmxpath is [datastorename]vmname/vmname.vmx</p>

0 Kudos
writetonikhil
Contributor
Contributor

I'll reply in the Plain text format...

I am using the [] brackets, but in last post it got converted to something else in the forum.

Anyways, It worked this time

D:\Study Material\Virtualization\VTM Project\VM Experiments\Scripts>perl Register.pl --server 10.77.161.118 --username Administrator --password ******* --vmxpath "[Local Datastore] VMNikhil/VMNikhil.vmx"

Registering VM '[Local Datastore] VMNikhil/VMNikhil.vmx'

D:\Study Material\Virtualization\VTM Project\VM Experiments\Scripts>

Weird...but I didn't change anything since last time. But yes, I change the ESX server on which I was trying.

Regards,

Nikhil

0 Kudos
arjunvenkatrama
Contributor
Contributor

I'm having trouble with this script as well. I'm running the following command:

./vmregister.pl --url https://a.b.c.d/sdk/webService --username Administrator --password ******* --host &lt;somehost&gt; --vmxpath "[dsname]VM/VM.vmx" --pool Resources

and i keep getting the error:

"Filtering is only supported for Simple Types

at ./vmregister.pl line 71"

Line 71 in the file refers to something about filtering folders. I have tried this with the "--filter" option turned on as will as without it.

Suggestions?

Arjun

0 Kudos