3

I have some powershell based on the thread Delete All Cached Objects in ARR Cache from Command Line or Powershell Script

       try{
            $url = $file.get($i)

            $m =( new-object Microsoft.Web.Administration.ServerManager )
            $x = $m.GetApplicationHostConfiguration().GetSection("system.webServer/diskCache");
            $method = $x.Methods["FlushUrl"].CreateInstance()
            $method.Input.SetAttributeValue("url", $url)
            $method.Execute();
            $evt.WriteEntry("$ScriptName Cache item $file($i) flushed on $env:computername "  ,$infoevent,3)
        }catch{
            $detail = $_.Exception.ErrorRecord.ToString()
            $evt.WriteEntry("$ScriptName Error flushing cache item $file($i) on $env:computername : $detail"   ,$errevent,4)
        }

$url is read in from a file. AFAIK I am supposed to give this a url in the form http://example.com

I would expect this to clear some cache items including full.gzip from the ARR IIS Application and Routing cache folders, but this full.gzip remains.

I have either got the wrong end of how this is supposed to work or the API's are not reliable.

Win2012 IIS 8.0

Community
  • 1
  • 1

0 Answers0