我正在尝试使用以下命令执行位于远程计算机上的 powershell 脚本,并且效果很好
调用命令 (powershell c:\install\install.ps1) -computername box1 -credential (get-credential)
上面的脚本依次从网络共享中复制文件(使用 robocopy)——它无法抱怨该位置不存在。发现这是由于权限问题。当我在脚本中明确提到使用以下凭据进行共享时,它会起作用
网络使用 \share1\files 密码 /user:username
有没有办法传递用于运行脚本的相同凭据,以供脚本访问远程计算机中的其他资源?
谢谢!桑吉夫