VMware Cloud Community
filip_hasa
Contributor
Contributor
Jump to solution

list files of datastore for virtual machine

Hello,

how to list files of datastore for virtual machine?! I cannot find it in command reference.

Thank you

Reply
0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

If you've installed vCLI and vSphere SDK for Perl, you'll have additional utilities on top of what's there with the vCLI, take a look at this list:

One script that can help with listing datastore files for a given VM is dsbrowse.pl

Here is an example:

[vi-admin@scofield ~]$ /usr/lib/vmware-vcli/apps/host/dsbrowse.pl --server himalaya.primp-industries.com --username root --name dlgCore-iSCSI.test


Information about datastore : 'dlgCore-iSCSI.test'
---------------------------
Summary
 Name             : dlgCore-iSCSI.test
 Location         : /vmfs/volumes/4a26f505-02dfd8a4-6867-003048d9586a
 File system      : VMFS
 Maximum Capacity : 15.75 GB
 Available space  : 11.654296875 GB

Hosts associated with this datastore.
 himalaya.primp-industries.com

Virtual machines on this datastore.
 None

Templates on this datastore.
 None

Datastore Folder Structure.
 Folder Path: '[http://dlgCore-iSCSI.test|http://dlgCore-iSCSI.test]'
 Files present
  testagain
  testlab-1
  testlab-2
  testlab-3
  testlab-4
  testlab-5
  testlab-6
  testlab-7
  testlab-8
  testlab-9
  testlab-10
  testlab-11
  testlab-12
  testlab-13
  testlab-14
  testlab-15

 Folder Path: '[http://dlgCore-iSCSI.test|http://dlgCore-iSCSI.test] testagain'
 Files present
  testagain.vmdk
  vmware.log
  testagain.nvram
  vmware-70.log
  vmware-65.log
  vmware-66.log
  vmware-68.log
  vmware-67.log
  vmware-69.log
  testagain-flat.vmdk
  testagain.vmx
  testagain.vmxf
  testagain.vmsd


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

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

Reply
0 Kudos
6 Replies
bulletprooffool
Champion
Champion
Jump to solution

Powershell wouild be easiest.

try this:

http://blogs.vmware.com/vipowershell/2009/08/how-to-list-datastores-that-are-on-shared-storage.html

One day I will virtualise myself . . .
Reply
0 Kudos
filip_hasa
Contributor
Contributor
Jump to solution

Thank you for tip. I founded it as well. But I thought PowerCLI and RCLI have compatibility by commands.

OK, I am gonna learn powershell ;o)

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

If you've installed vCLI and vSphere SDK for Perl, you'll have additional utilities on top of what's there with the vCLI, take a look at this list:

One script that can help with listing datastore files for a given VM is dsbrowse.pl

Here is an example:

[vi-admin@scofield ~]$ /usr/lib/vmware-vcli/apps/host/dsbrowse.pl --server himalaya.primp-industries.com --username root --name dlgCore-iSCSI.test


Information about datastore : 'dlgCore-iSCSI.test'
---------------------------
Summary
 Name             : dlgCore-iSCSI.test
 Location         : /vmfs/volumes/4a26f505-02dfd8a4-6867-003048d9586a
 File system      : VMFS
 Maximum Capacity : 15.75 GB
 Available space  : 11.654296875 GB

Hosts associated with this datastore.
 himalaya.primp-industries.com

Virtual machines on this datastore.
 None

Templates on this datastore.
 None

Datastore Folder Structure.
 Folder Path: '[http://dlgCore-iSCSI.test|http://dlgCore-iSCSI.test]'
 Files present
  testagain
  testlab-1
  testlab-2
  testlab-3
  testlab-4
  testlab-5
  testlab-6
  testlab-7
  testlab-8
  testlab-9
  testlab-10
  testlab-11
  testlab-12
  testlab-13
  testlab-14
  testlab-15

 Folder Path: '[http://dlgCore-iSCSI.test|http://dlgCore-iSCSI.test] testagain'
 Files present
  testagain.vmdk
  vmware.log
  testagain.nvram
  vmware-70.log
  vmware-65.log
  vmware-66.log
  vmware-68.log
  vmware-67.log
  vmware-69.log
  testagain-flat.vmdk
  testagain.vmx
  testagain.vmxf
  testagain.vmsd


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

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
filip_hasa
Contributor
Contributor
Jump to solution

It is too complex for me but good direction. My solution is vifs.pl

\# vifs2.pl -Z DS --dir \[L1A_G4_R5_001\]VUPAJS001

Parent Directory

VUPAJS001-6f6374fc.hlog

VUPAJS001-6f6374fc.vswp

VUPAJS001-aux.xml

VUPAJS001-flat.vmdk

VUPAJS001.nvram

VUPAJS001.vmdk

VUPAJS001.vmsd

VUPAJS001.vmx

VUPAJS001.vmxf

vmware-15.log

vmware-16.log

vmware-17.log

vmware-18.log

vmware-19.log

vmware-20.log

vmware.log

I found bug in vifs.pl ;o) see separate thread.

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

See if this script helps:

What bug did you find in vifs.pl?

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

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
filip_hasa
Contributor
Contributor
Jump to solution

Please see this: new vifs.pl

Here it similar solution but only for list directory.http://networkadminkb.com/kb/Knowledge%20Base/VMWare/Unable%20to%20list%20Folders%20of%20Datastores%20in%20VIFS.pl%20Script.aspx

Thank you for interest

Do you think anybody can be interest for script which can export one vmdk and vmx file?

Reply
0 Kudos