Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Search for VMDK in all datastores

Posted on 2013-12-27
10
Medium Priority
?
3,882 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 124

Assisted Solution

by:Andrew Hancock (VMware vExpert / EE MVE^2)
Andrew Hancock (VMware vExpert / EE MVE^2) earned 1004 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 332 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 42

Assisted Solution

by:Paul Solovyovsky
Paul Solovyovsky earned 332 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 332 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
 
LVL 124

Assisted Solution

by:Andrew Hancock (VMware vExpert / EE MVE^2)
Andrew Hancock (VMware vExpert / EE MVE^2) earned 1004 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 124

Accepted Solution

by:
Andrew Hancock (VMware vExpert / EE MVE^2) earned 1004 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Veeam Backup & Replication has added a new integration – Veeam Backup for Microsoft Office 365.  In this blog, we will discuss how you can benefit from Office 365 email backup with the Veeam’s new product and try to shed some light on the needs and …
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
Teach the user how to configure vSphere clusters to support the VMware FT feature Open vSphere Web Client: Verify vSphere HA is enabled: Verify netowrking for vMotion and FT Logging is in place or create it: Turn On FT for a virtual machine: Verify …
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…

618 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