【问题标题】:Why do these two powershell commands not return the same result?为什么这两个 powershell 命令返回的结果不一样?
【发布时间】: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


    【解决方案1】:

    您总共有超过 200 个网站吗?

    尝试使用-Limit ALL

    我认为第一个语句是一个命令,所以只有 200 个 web 被返回

    第二个语句是多个命令,因此将返回(站点数 * 200)个网站(如果有的话)

    【讨论】:

    • 奇怪的是,命令get-spsite | get-spweb -Limit All 正在返回所有网站
    • 我已经添加了命令的实际输出(匿名数据,但所有结果都在这里)
    猜你喜欢
    • 2019-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多