【问题标题】:powershell check sharepoint URLspowershell 检查共享点 URL
【发布时间】:2010-12-04 16:02:47
【问题描述】:

我正在尝试编写一个脚本来遍历一堆共享点 URL 并验证它们是否存在。

据我所知,这应该可行:

$webclient = new-object System.Net.WebClient
$webclient.Credentials = new-object System.Net.NetworkCredential ("username", "password", "domain")
$webpage = $webclient.DownloadString("http://sharepointurl")

这对我不起作用......我不断收到:

使用“1”参数调用“DownloadString”的异常:“远程服务器返回错误:(401) 未经授权。”

我错过了什么?

【问题讨论】:

  • 您可以使用 fiddler 或 wireshark 来检查请求以确保其上有 auth 部分吗?

标签: sharepoint authentication powershell active-directory


【解决方案1】:

如果您当前的凭据在 Sharepoint 站点上具有权限,则跳过网络凭据并仅使用默认凭据,例如:

$webClient.UseDefaultCredentials = $true

【讨论】:

    【解决方案2】:

    你可以使用

    (Invoke-webrequest -URI "https://www.yoururl.com").Content

    参考:Display all content with Invoke-WebRequest

    【讨论】:

      猜你喜欢
      • 2017-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多