2011-03-16 92 views
1

在PowerShell脚本中,我想获取所有SPWeb对象。为什么这两个powershell命令不会返回相同的结果?

如果我使用这个命令:

get-spsite | get-spweb 

我没有得到比命令相同的结果:

get-spsite | foreach {Get-SpWeb -Site $_ } 

[编辑]以下命令也在努力,甚至在限额默认值为200:

get-spsite | get-spweb -Limit All 

第二个命令返回所有的Web,其中第一个跳过其中的一些(在我的情况下,企业维基站点和搜索中心站点与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 

回答

0

你有总计超过200个网?

尝试使用-Limit ALL

我觉得第一条语句是一个命令,所以只有200网是回报

第二条语句是多个命令,所以会返回网(网站* 200的数)(如果你有他们)

+0

不,只有20在农场 – 2011-03-17 12:51:24

+0

奇怪的是,命令'get-spsite | get-spweb -Limit All'正在返回所有网络 – 2011-03-17 12:54:16

+0

我已经添加了命令的实际输出(匿名数据,但所有结果都在这里) – 2011-03-17 12:58:31