Why do these two powershell commands not return the same result?
In a powershell script, I want to get all SPWeb objects.
If I use this command :
get-spsite | get-spweb
I do not get the same results than the command :
get-spsite | foreach {Get-SpWeb -Site $_ }
[Edit] the following command is also working, even in the default value of limit is 200 :
get-spsite | get-spweb -Limit All
[/Edit]
The second command returns all Webs, where the first on skip some of them (in my开发者_StackOverflow case, an enterprise wiki site, and a search center site are skipped, together with their OWA web cache)
Why ?
The actual output is the following :
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
have you got more than 200 webs in total?
try using -Limit ALL
i think the first statement is one command, so only 200 webs are return
the second statement is multiple commands, so will return (number of sites * 200) webs (if you have them)
精彩评论