Category Archives: ESXi RCLI write and read

ESXi RCLI write and read

I have been working with the RCLI appliance, in a attempt to get -g and -p working.
vifs -g and vifs -p

However, I am lacking the correct command augments, so it will be trial and error.

Unless anyone knows the correct command.

UPDATE:

Getting closer, to list I found this command.

HERE http://vmware.com/pdf/vi3_35/esx_3/r35u2/vi3_35_25_u2_rcli.pdf

From the guide


Examples for vifs
This section gives some examples for vifs. Executing vifs works only when you are
connected directly to an ESX Server 3i host. The command does not work when you
connect to a VirtualCenter Server and attempt to connect to the ESX Server 3i host
through the VirtualCenter Server.

You can execute the commands listed below on a Linux system. For corresponding
commands on a Windows system, use double quotes instead of single quotes.
The following examples for vifs require connection options. See “Specifying Options
for Remote CLI Commands” on page 19.

vifs.pl –copy ‘[myvmfs] dir_1/my_text’ ‘[myvmfs] dir_3/text’
Copies the my_text file from dir_1 to dir_3.

vifs.pl –dir ‘[myvmfs] dir_3’
Lists the contents of directory dir_3.

vifs.pl –copy ‘[myvmfs] dir_1/my_text’ ‘[myvmfs] dir_3/my_text’
–force
Copies the my_text file into dir_3. If you use this command, and a file named my_text
already exists in dir_3, the command overwrites the existing file because of the
–force option.

vifs.pl –mkdir ‘[myvmfs] new_dir’
Creates the directory called new_dir.

vifs.pl –put /root/test_put ‘[myvmfs] new_dir/test_put’
Places a copy of the local test_put file into the specified server’s new_dir directory.

vifs.pl –rm ‘[myvmfs] new_dir/test_put’
Removes the test_put file from the new_dir folder.

vifs.pl –rmdir ‘[myvmfs] new_dir’
Removes the new_dir folder.

vifs.pl –get ‘[myvmfs] dir_1/my_text’ /root/my_text
Retrieves the file my_text from the ESX Server 3i host and places it in the local
machine’s root folder.

vifs.pl –move ‘[myvmfs] dir_1/my_text’ ‘[myvmfs] dir_3/my_text’
Moves the my_text file from dir_1 to dir_3.

vifs.pl –listds
Lists the names of all datastores on the server specified in the configuration file. You can
use each name that has been returned to refer to datastore paths using square bracket
notation, as follows:
‘[my_datastore] dir/subdir/file’

C:Program Files (x86)VMwareVMware VI Remote CLIbin>vifs.pl –server ipaddress -D “[datastore]” lists the datastore

The command

C:Program Files (x86)VMwareVMware VI Remote CLIbin>vifs.pl –server ipaddress -g “[datastore] nst-1.8.0.iso” C:
‘chcp’ is not recognized as an internal or external command,
operable program or batch file.
Use of uninitialized value in numeric eq (==) at C:/Program Files (x86)/VMware/V
Mware VI Remote CLI/Perl/lib/VMware/VILib.pm line 392.
Use of uninitialized value in numeric eq (==) at C:/Program Files (x86)/VMware/V
Mware VI Remote CLI/Perl/lib/VMware/VILib.pm line 393.
Use of uninitialized value in numeric eq (==) at C:/Program Files (x86)/VMware/V
Mware VI Remote CLI/Perl/lib/VMware/VILib.pm line 394.
Enter username: root
Enter password:
Downloaded file nst-1.8.0.iso to C:/nst-1.8.0.iso successfully.

By no means was this overly fast, as it took me a few minutes to copy this from the server to my workstation, the file was a 500mb iso.

However, it did work.

Alright, how to do I delete?

I try

C:Program Files (x86)VMwareVMware VI Remote CLIbin>vifs.pl –server ipdaddress -rm “[datastore] nst-1.8.0.iso”
‘chcp’ is not recognized as an internal or external command,
operable program or batch file.
Use of uninitialized value in numeric eq (==) at C:/Program Files (x86)/VMware/V
Mware VI Remote CLI/Perl/lib/VMware/VILib.pm line 392.
Use of uninitialized value in numeric eq (==) at C:/Program Files (x86)/VMware/V
Mware VI Remote CLI/Perl/lib/VMware/VILib.pm line 393.
Use of uninitialized value in numeric eq (==) at C:/Program Files (x86)/VMware/V
Mware VI Remote CLI/Perl/lib/VMware/VILib.pm line 394.
Enter username: root
Enter password:
Remove ‘nst-1.8.0.iso’? (y/n) : yes
Deleted file [datastore] nst-1.8.0.iso successfully.

and it worked!

Next, can I put a file on my ESXi Server?

C:Program Files (x86)VMwareVMware VI Remote CLIbin>vifs.pl –server ipaddress -p C:33.iso “[datastore] 33.iso”
‘chcp’ is not recognized as an internal or external command,
operable program or batch file.
Use of uninitialized value in numeric eq (==) at C:/Program Files (x86)/VMware/V
Mware VI Remote CLI/Perl/lib/VMware/VILib.pm line 392.
Use of uninitialized value in numeric eq (==) at C:/Program Files (x86)/VMware/V
Mware VI Remote CLI/Perl/lib/VMware/VILib.pm line 393.
Use of uninitialized value in numeric eq (==) at C:/Program Files (x86)/VMware/V
Mware VI Remote CLI/Perl/lib/VMware/VILib.pm line 394.
Enter username: root
Enter password:
Uploaded file C:33.iso to 33.iso successfully.

Looks ok, but when I browse there, no good. whats up? A close look at the guide says it all

–put
-p


Uploads a file from the machine on
which you run the Remote CLI to the
ESX Server 3i host. This operation
uses HTTP PUT.
This command can replace existing
host files but cannot create new files.
Datastore
Host,
Temp
put src_local_file_path
dst_file_path
put src_local_file_path
dst_directory_path

So I can replace a existing file, but not upload a new file.

Now my only question is, is their newer documentation?

Roger