Solved

Search for VMDK in all datastores

Posted on 2013-12-27
10
3,001 Views
Last Modified: 2013-12-31
I have deleted a VM for VSphere client , I was not sure if I deleted it from disk.
I would like to search for it in all datastores. is there an easy way to find it so that I can delete the related files.

Thanks
0
Comment
Question by:jskfan
10 Comments
 
LVL 118

Assisted Solution

by:Andrew Hancock (VMware vExpert / EE MVE)
Andrew Hancock (VMware vExpert / EE MVE) earned 251 total points
ID: 39743027
The VMware Community Pack has a script which can show unallocated or orphanced VMDK files, e.g. VMDK (virtual machine disks) which are not connected to any VM in the inventory.

or using PowerCLI

# this example will list all files and subfolders that starts with Win7
# inside the datastore with name datastore1.

ls vmstores:\myServer@443\Datacenter\datastore1\Win7*

Open in new window


or you could login to the server via SSH/Console, and use the ls command
0
 

Author Comment

by:jskfan
ID: 39743060
Do I need to login to each ESX server via SSH and run the command you posted ?
0
 
LVL 40

Assisted Solution

by:coolsport00
coolsport00 earned 83 total points
ID: 39743070
@jskfan - no, if you log in to PowerCLI, your first command would be:
Get-ExecutionPolicy

If Restricted is shown, type:
Set-ExecutionPolicy RemoteSigned

Run Get-ExecutionPolicy again to verify the policy changed to RemoteSigned

Next, connect to your vSphere infrastructure - specifically, to vCenter by typing:
Connect-VIServer vcenterServerNameOrIP

Then, you can run Andrew's cmd and it will be run against your whole infrastructure that is connect to that particular vCenter Server.

Regards,
~coolsport00
0
 
LVL 42

Assisted Solution

by:paulsolov
paulsolov earned 83 total points
ID: 39743107
another way to do this is to install rvtools (robware.net).  Great tool and one of the columns has a health tab which includes "zombie" VMs, basically VMs that are on the datastore but are not registered.  This is a easy way to get what you need.

Also has a lot of good info like snapshots, space left on volumes, etc..
0
 
LVL 8

Assisted Solution

by:piyushranusri
piyushranusri earned 83 total points
ID: 39743116
please browse these related URL

1. http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1005049
2.http://kevinmarkwardt.com/orphans/ ( a script to create a list of all of the vmdk’s on the current VM’s and then it will scan all of the datastores and attempt to match them up)


please share the output
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 118

Assisted Solution

by:Andrew Hancock (VMware vExpert / EE MVE)
Andrew Hancock (VMware vExpert / EE MVE) earned 251 total points
ID: 39743351
If you have limited experience of PowerCLI, I would recommend the VMware Community Pack, which is almost designed ready to go with limited PowerCLI scripting abilities.
0
 

Author Comment

by:jskfan
ID: 39744712
Is this command Powercli ?

ls vmstores:\myServer@443\Datacenter\datastore1\Win7*

it looks like Linux

I have installed powercli. I am not sure which is better powercli or vcli..I believe vcli uses Linux commands while powercli uses Microsoft commands
0
 

Author Comment

by:jskfan
ID: 39744717
I guess powercli will use : Get-VM  command
0
 
LVL 118

Accepted Solution

by:
Andrew Hancock (VMware vExpert / EE MVE) earned 251 total points
ID: 39744800
Yes, it's a VMware command, it actually "pipes the command" to the ESXi console.

I would recommend using the following, also VMware recommends the use of PowerCLI, which is PowerShell interface with vSphere-specific additions.

http://communities.vmware.com/community/vmtn/server/vsphere/automationtools/powercli

One of the simplest PowerCLI examples, and something which is actually extremely useful on its own, is the Get-VM cmdlet. Which lists VMs.

PowerCLI can be a bit overwhelming to use,  But it can be enhanced with a nice toolset and a library of preconfigured scripts to jump-start your mass changes, which is possible with PowerGUI

http://powergui.org/index.jspa

again, if you are not familiar with PowerCLI use the

VMware Community Pack

http://www.virtu-al.net/featured-scripts/vmware-powerpack/
0
 

Author Closing Comment

by:jskfan
ID: 39748622
Thank you
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

This is an issue that we can get adding / removing permissions in the vCSA 6.0. We can also have issues searching for users / groups in the AD (using your identify sources). This is how one of the ways to handle this issues and fix it.
Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
Teach the user how to rename, unmount, delete and upgrade VMFS datastores. Open vSphere Web Client: Rename VMFS and NFS datastores: Upgrade VMFS-3 volume to VMFS-5: Unmount VMFS datastore: Delete a VMFS datastore:
This Micro Tutorial walks you through using a remote console to access a server and install ESXi 5.1. This example is showing remote access and installation using a Dell server. The hypervisor is the very first component of your virtual infrastructu…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now