VMware Cloud Community
pamiller21
Enthusiast
Enthusiast

Script to clean up datastores

Hey all,

I am looking for a script to to help me clean up datastores from left over files.  After vmotion sometimes the datastore leaves behind folders with only files with the exts, .hlog .nvram -aux.xml and .vmxf files.  I would like to see if it is possible to make a script to help round up and delete these.

Thanks in advance,

Andy

0 Kudos
27 Replies
pamiller21
Enthusiast
Enthusiast

Hey dude, I think we are missing the Remove-VmwFile function is not attached.

0 Kudos
LucD
Leadership
Leadership

Both functions are in the same .ps1 file.

When I scroll down, I can see the function.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
pamiller21
Enthusiast
Enthusiast

Whelp, I feel foolish.  Thanks a ton, I did my first run and the script works like excellent.  I then reviewed the datastore and still see some .hlog and .vmxf files sitting inside folders alone.  Anyway to kill these and the folder if they are this useless?

0 Kudos
LucD
Leadership
Leadership

I was looking at those, and a few others.

The problem is that they are not listed by the SearchDatastoreSubFolders method.

I'm looking for an alternate method to find them.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
pamiller21
Enthusiast
Enthusiast

Hey LucD,

How are things going on this, I just wanted to check in.

Andy

0 Kudos
LucD
Leadership
Leadership

I'll have to disappoint you I'm afraid.

None of the alternatives I was looking at seems to be able to do that Smiley Sad


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
bikashyadav
Contributor
Contributor

Hi LucD,

How can we change the size & Capacity from KB to GB? The Size and Capacity are in KB right now.

Thanks

Bikash

0 Kudos
LucD
Leadership
Leadership

I replied to the other thread (where you asked the same question)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos