If you'd like to share your story I'll be happy to share it here on my blog or at powershell.org. Just let me know in the comments. I'm always interested in how others are using PowerShell.

Without further ado, here's our first story brought to you by Paul Abke.

We use several software packages that use Excel extensively.

The packages all use Excel add-ins to offer special functionality. After time, the Excel15.xlb file gets bloated and causes Excel to behave badly.

I wanted an automated way to delete the bloated files in all the users' profiles.
Fortunately we use Citrix XenApp so all our users' profiles are centrally located.

I used get-item | get-member to discover the delete method for the get-item cmdlet.

Using get-help | get-item will uncover that the get-item cmdlet supports wildcards in the path parameter so searching for the Excel15.xlb file was easy.

`ForEach-Object` loops through the results of get-item. $_ represents the current item in the pipeline so using the delete method took just a few keystrokes.

Test before using in a production environment!
Get-Item G:\Profiles$\TSProfiles\*\*\AppData\Roaming\Microsoft\Excel\*.xlb | ForEach-Object {
    $_.delete()
}

Join the Jar Tippers on Patreon

It takes a lot of time to write detailed blog posts like this one. In a single-income family, this blog is one way I depend on to keep the lights on. I'd be eternally grateful if you could become a Patreon patron today!

Become a Patron!