使用invoke-command

时间:2017-10-23 08:40:24

标签: powershell batch-file powershell-remoting

最近我在服务器上执行批处理文件时遇到了一些问题。每当我尝试使用Invoke-Command启动bat文件(它只是为了测试目的创建一个txt文件)时,它不会返回任何错误,也不会创建文本文件。我一直在谷歌上搜索这个东西好几个小时但没找到任何有用的信息。也许我没有特定的权限?

我使用CredSSP进行身份验证。我需要在ScriptBlock中使用Invoke-Command

我一直在使用的代码: 批次:

echo 123>test.txt

Powershell的:

invoke-command -ComputerName $s -ScriptBlock $block -Credential $cred -Authentication CredSSP -ArgumentList $test

0 个答案:

没有答案