小编Lui*_*Liu的帖子

Powershell在远程机器中运行Bat文件

I modified a function I got from Microsoft forum, it purpose is to run copy a bat file to a remote machine and to run it there. I could see the file being copied over, however it seems not working when I try to call the Invoke-Command to execute the file. Any advice will be appreciated, thank you :)

function Run-BatchFile ($computer, [string]$batLocation)
{

    $sessions = New-PSSession -ComputerName $computer -Credential qa\qalab3
    Copy-Item -Path $batLocation -Destination "\\$computer\C$\MD5temp" #copy the file locally …
Run Code Online (Sandbox Code Playgroud)

powershell batch-file

1
推荐指数
1
解决办法
3万
查看次数

标签 统计

batch-file ×1

powershell ×1