【发布时间】:2011-03-31 02:56:12
【问题描述】:
在 powershell 脚本中,我想获取所有 SPWeb 对象。
如果我使用这个命令:
get-spsite | get-spweb
我没有得到与命令相同的结果:
get-spsite | foreach {Get-SpWeb -Site $_ }
[Edit]下面的命令也可以工作,即使在limit的默认值是200的情况下:
get-spsite | get-spweb -Limit All
[/编辑]
第二个命令返回所有 Web,第一个命令跳过其中的一些(在我的例子中,企业 wiki 站点和搜索中心站点连同它们的 OWA Web 缓存一起被跳过)
为什么?
实际输出如下:
PS C:\Windows\system32> get-spsite | get-spweb
Url
---
http://clients
http://clients/sites/Office_Viewing_Service_Cache
http://clients/xxxxxxx
http://intranet
http://intranet/PressReleases
http://intranet/Search
http://intranet/wiki
http://intranet/sites/Office_Viewing_Service_Cache
http://my
http://my/personnel/yyyyy
http://my/sites/broadcast
http://my/sites/Office_Viewing_Service_Cache
http://projets
http://projets/sites/zzzzzz
http://projets/sites/zzzzzz/gedqualite
http://projets/sites/Office_Viewing_Service_Cache
http://projets/sites/xxxxxxx
http://projets/sites/xxxxxxx/wwwww
http://projets/tfs/Protos
http://projets/tfs/Protos/pokerstars
PS C:\Windows\system32> get-spsite | get-spweb -Limit all
Url
---
http://clients
http://clients/sites/Office_Viewing_Service_Cache
http://clients/xxxxxxx
http://intranet
http://intranet/PressReleases
http://intranet/Search
http://intranet/wiki
http://intranet/sites/Office_Viewing_Service_Cache
http://my
http://my/personnel/yyyyy
http://my/sites/broadcast
http://my/sites/Office_Viewing_Service_Cache
http://projets
http://projets/sites/zzzzzz
http://projets/sites/zzzzzz/gedqualite
http://projets/sites/Office_Viewing_Service_Cache
http://projets/sites/xxxxxxx
http://projets/sites/xxxxxxx/wwwww
http://projets/tfs/Protos
http://projets/tfs/Protos/pokerstars
http://search
http://search/sites/Office_Viewing_Service_Cache
http://wiki
http://wiki/sites/Office_Viewing_Service_Cache
【问题讨论】:
标签: powershell sharepoint-2010