1

I'm a little bit stuck because I would like to delete some VMDK file from vSphere with a PowerShell or PowerCLI command.

I know how to do that from the vSphere vCenter GUI but I didn't find how to do that with a command.

Do you think that there is a way to do that with something like:

Remove-Item path/to/my/VMDK

If someone has already made this, can you show me how?

codewario
  • 19,553
  • 20
  • 90
  • 159
TomTom30
  • 35
  • 5

2 Answers2

0

You could use the vmstores PSDrive option that will allow you to use standard PowerShell functionalities alongside an authenticated vSphere session.

Example of polling your available datastores:

dir -Recurse -Path vmstores:\

Additional info: Browse datastores using PowerCLI

Kyle Ruddy
  • 1,886
  • 1
  • 7
  • 5
0

You can also remove the vmdk file with the powercli Remove-Harddisk cmdlet (with -DeletePermanently you physically remove the vmdk from the datastore).

NiMux
  • 826
  • 7
  • 16
NickMartin
  • 91
  • 5