chakoe
Enthusiast
Enthusiast

deleting some *.vmss-files on different Datastores

Hi,

i want to search some Datastores and their subdirectories for *.vmss - files and then i want to delete them.

the ESX-Servers which i want to search have local-storage named esx2401-local , esx2402-local and following

My actual script looks like:

dir 'vmstores:\virtualcenter@443\Production\Datacenter1\esx24*\*\*.vmss'

Is this the right way?

Thx in advance

Chakoe

0 Kudos
4 Replies
chakoe
Enthusiast
Enthusiast

Update:

Script now looks like:

dir "vmstores:\virtualcenter@443\Production\Datacenter1\esx24*\*\*.vmss" -Recurse  | % { Remove-Item $_ }

The first part works fine...but the second part ( Remove..) does not work...no output

Any idea?

Thx in advance

0 Kudos
kunaludapi
Expert
Expert

I tested your script within my lab, not giving any output but it is working. I tested it on logs and they removed.

dir vmstores:\192.168.33.21@443\ha-datacenter\datastore1\*.log -Recurse | Remove-Item

--------------------------------------------------------------- Kunal Udapi Sr. System Architect (Virtualization, Networking And Storage) http://vcloud-lab.com http://kunaludapi.blogspot.com VMWare vExpert 2014, 2015, 2016 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
a_p_
Leadership
Leadership

Just a quick note. You've been a forum member since quite some time, so I assume you know what you do. Anyway, the .vmss files contain the "VM suspend state" of suspended/paused virtual machines and deleting these files is like pulling the power plug on a powered on system. Is this what you want to do?

André

0 Kudos
chakoe
Enthusiast
Enthusiast

Hi,

yes, this is what i want to do in this case...

Background:

We started some scheduled Tasks ( Host-Remediation via VUM, Suspend VMs )

After the remediation, the ESx came back online and successfully started the VMs

out of the suspended state... But *.vmss-Files stayed in each subdirectory...

In our case ( local storage) this  means an 11 GB File for Each VM which isn´t used

or needed anymore...

0 Kudos