Enable and Flush Site Output Cache using PowerShell

I had a requirement to enable the site output cache across all sites in our web application. I found an excellent script by Travis Smith called Set-SPSiteOutputCache. I downloaded that and simply put a loop wrapper around it. In my settings, I set the cache as Disabled for anonymous users and as Extranet for authenticated users.


I also prepared a small script to flush the object cache in all sites as: