如何访问Invoke-command中的网络共享驱动器

时间:2017-11-15 20:31:49

标签: powershell powershell-v2.0

我使用下面的脚本将文件从网络共享复制到本地驱动器。但是,我无法访问路径并获得Path not found错误。我的用例是我需要从Jenkins服务器执行此脚本并远程执行到server1,然后从共享目录(\ server2 \ QlikView)中复制文件,该目录已作为S:\ drive挂载到server1。我能够从powershell访问此共享路径如果我从server1.But运行命令,而不是在Invoke-Command脚本块中运行,如图所示。有什么想法吗?

<h3>Header
  <div>
    <div class='rg-container'>
      <div class='rg-content'>
        <table class='rg-table-head'>
          <thead>
            <tr>
              <th class='text '>id</th>
              <th class='text '>somcol</th>
              <th class='text '>biggger id</th>
              <th class='text '>another id</th>
              <th class='text '>med col</th>
              <th class='text '>med col</th>
            </tr>
          </thead>
        </table>
        <table class="rg-table-body">
          <tbody>

            <tr class=''>
              <td class='text ' data-title='id'>id</td>
              <td class='text ' data-title='somcol'>somcol</td>
              <td class='text ' data-title='biggger id'>biggger id</td>
              <td class='text ' data-title='another id'>another id</td>
              <td class='text ' data-title='med col'>med col</td>
              <td class='text ' data-title='med col'>med col</td>
              <td class='text ' data-title='sheet'>sheet</td>
              <td class='text ' data-title='sheet'>sheet</td>
              <td class='text ' data-title='anotherbigcoloumn'>another big coloumn</td>
              <td class='text ' data-title='small'>small</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
</h3>

1 个答案:

答案 0 :(得分:1)

默认情况下,PowerShell远程处理不允许凭据授权或&#34;第二跳&#34;。如果要从远程会话连接到远程计算机(在本例中为网络共享),则需要允许将凭据委派给该计算机。要允许它,您需要配置CredSSP。请查看此处了解有关问题的详细信息以及如何设置问题:https://blogs.technet.microsoft.com/heyscriptingguy/2012/11/14/enable-powershell-second-hop-functionality-with-credssp/

相关问题