Clear PowerShell Sharepoint Cache? Clear PowerShell Sharepoint Cache? powershell powershell

Clear PowerShell Sharepoint Cache?


Turns out that PowerShell is actually caching some stuff in particular the OWSSVR.DLL.

There are two (and ½) ways to overcome the problem:

  1. Use a nifty PowerShell snippet to kill a Sharepoint thread and reload a DLL
  2. Use a different PowerShell session started from within the first session
  3. Use old-school stsadm to create the site as stsadm lives within another thread and hence "sees" the new site templates already

I went with method 2 ½ (denoted 3) as it is just the easiest using a one-liner stsadm instead of calling up yet another PS session.


I can't check from here, but it's possibly got something to do with the web being cached in the current "assignment collection." Take a look at the Start- and Stop-SPAssignment commands. I'm not sure what the default assignment model is, but I'd try running "Stop-SPAssignment; Start-SPAssignment" to see if that will dispose of the current cached SPWeb being used to retrieve templates.

-Oisin