2011-03-16 122 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

相關問題