清除 PowerShell Sharepoint 缓存? [英] Clear PowerShell Sharepoint Cache?

查看:73
本文介绍了清除 PowerShell Sharepoint 缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题:

我使用 PowerShell 部署了一个包含内容和站点模板的 WSP 包

I deployed a WSP package containing stuff and a site template using PowerShell

Add-SPSolution ...
Install-SPSolution ...

现在尝试创建新网站集时,我的模板可见,我可以使用我的模板创建新网站集.

When now trying to create a new Site Collection, my template is visible and I can create a new site collection with my template.

当我尝试使用 PowerShell (Get-SPWebTemplate) 查看所有已安装的站点模板时在与之前相同的会话中,新模板没有出现!

When I try to look at all the installed site templates with PowerShell (Get-SPWebTemplate) in the same session as before, the new template does not appear!

反之亦然:撤回/删除解决方案时,我无法再使用模板创建新网站集,因为它已经消失了.但在仍然打开的 PowerShell 会话中,模板仍然可见.

The same goes visa-versa: When retracting/deleting the solution, I cannot create a new site collection with the template anymore since it's gone. But in the still open PowerShell session the template is still visible.

唯一的解决方案:在解决方案被收回/部署后打开一个新的 PowerShell 会话 - 只有在这个新"会话中,更改才会同步.

The only solution: Open up a new PowerShell session after the solution has been retracted/deployed - only in this "fresh" session, the changes are synchronized.

我的问题是:如何清除此 PowerShell 缓存?如何直接从服务器而不是从某些缓存中获取站点模板列表?

其他一些人也想出了关闭/重新打开 PowerShell (PowerShell 缓存导致头疼) - 这不是解决方案...

Some other guy also came up with closing/re-opening PowerShell (PowerShell caching leads to head-banging) - this can't be the solution...

免责声明:来自如何清除 PowerShell 对象模型缓存"的交叉帖子.

推荐答案

事实证明 PowerShell 实际上缓存了一些东西,特别是 OWSSVR.DLL.

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

有两种(和 ½)方法可以解决这个问题:

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

  1. 使用漂亮的 PowerShell 代码段杀死一个 Sharepoint 线程并重新加载一个 DLL
  2. 使用从第一个会话中启动的不同 PowerShell 会话
  3. 使用老式 stsadm 创建站点,因为 stsadm 位于另一个线程中,因此已经看到"了新站点模板

我采用了方法 2 ½(表示为 3),因为它是最简单的方法,使用单行 stsadm 而不是调用另一个 PS 会话.

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.

这篇关于清除 PowerShell Sharepoint 缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆