1

我正在尝试使用以下命令执行位于远程计算机上的 powershell 脚本,并且效果很好

调用命令 (powershell c:\install\install.ps1) -computername box1 -credential (get-credential)

上面的脚本依次从网络共享中复制文件(使用 robocopy)——它无法抱怨该位置不存在。发现这是由于权限问题。当我在脚本中明确提到使用以下凭据进行共享时,它会起作用

网络使用 \share1\files 密码 /user:username

有没有办法传递用于运行脚本的相同凭据,以供脚本访问远程计算机中的其他资源?

谢谢!桑吉夫

4

2 回答 2

2

你需要的是 credSSP。检查这篇文章: http ://www.ravichaganti.com/blog/?p=1230

于 2011-01-04T17:12:49.503 回答
0

使用远程调用时,将凭据作为参数传递给 power shell 脚本invoke-command。将这些凭据nextinstall.ps1.

于 2011-01-04T17:00:52.560 回答