Shadows of the Past



                                                          Frustration leads to productivity; at-least its true in my case. Every single time I happen do something remotely productive, the credits fly away to something I'm bored of.
So its been a super-busy day juggling through the best offers on Amazon Great Indian Festival and the Flipkart Big Billion Sale, and Chrome just gives up on me, which is presumably due to the number of tabs open; Persistent crashes make me realize that neither do I have a reason to shop nor the patience to put up with this sheet.

Casually grazed through my ticket queue to find a disk space issue logged to me; I'm apparently/supposedly not supposed to work on disk space issues unless its a change to increase the assigned storage. An in-depth look tells me why it came directly over to me: The first line has identified a VHD that has filled up the whole 1 TB drive, and they aren't sure if the disk could be removed. I presume they'd have tried moving it to another drive, which they usually do with ISOs.

It happens to be a Windows Backup Image holding copies from last December, till date.
Windows Server Backup always removes the oldest version of backup if ti fills up the logical drive, but I was wholly aware of the pain it'd take to customize the alert for the server or making the Monitoring engineers as to how this works.

Plan B:
I could do two things now - remove oldest shadow copies, and wait for the alert get re-generated in another month or so.
Or script the removal of shadows, and forget the server exists.

The lazy ass in me still opted for the script as the Chrome was still playing foul, and apparently I had nothing else to do.

A simple script was all it took, but getting it working on a PS v3 machine was the challenge here.
All I did here was integrating publicly available script segments and putting it to use in a more productive way.

Th parameters required are the free space required, and the drive that holds the shadows; 40 and F: in my case
Here you go:

The only stuff you need

The script is available here: ShadowCopyDel.ps1

References:

  1. https://stackoverflow.com/questions/13284686/use-diskshadow-with-powershell
  2. https://stackoverflow.com/questions/55350528/powershell-script-for-finding-the-total-memory-space-of-c-drive
Any ideas if Stack Overflow has a premium subscription?



Comments

Popular Posts