我想使用powershell映射远程计算机上的网络硬盘

时间:2013-06-21 10:01:15

标签: powershell remote-access windows-server-2012

我以为我可以这样做:

  

psexec \\ func2_web1 New-PSDrive -Name x -PSProvider FileSystem -Root   \\ argento \ drops -Persist

但是失败了,并回复了这条消息:

  

PsExec v1.98 - 远程执行进程版权所有(C)2001-2010 Mark   Russinovich Sysinternals - www.sysinternals.com

     

PsExec无法在func2_web1上启动New-PSDrive:

我在func2_web1上启用了PSRemoting(我可以对该机器运行其他psexec命令就好了。)

有谁知道如何在远程计算机上映射硬盘?

由于

1 个答案:

答案 0 :(得分:0)

PSExec不是“PowerShell exec”的缩写,它是“进程执行”。您无法直接从中执行PowerShell cmdlet。要使用PSExec远程执行PowerShell命令,您必须执行以下操作(未经测试,因为我没有psexec):

psexec \\func2_web1 powershell.exe -command -nologo "New-PSDrive -Name x -PSProvider FileSystem -Root \\argento\drops -Persist"

或者,如果您想从本地PowerShell会话中转到远程路由:

invoke-command -computername func2_web1 -scriptblock {New-PSDrive -Name x -PSProvider FileSystem -Root \\argento\drops -Persist}

使用后者,您可能会遇到需要resolved via CredSSP的“双跳”问题。