首页 > 解决方案 > 如何使用 Azure DevOps 在远程 Windows 机器上运行批处理文件,在目标机器上运行 Powershell?

问题描述

我想通过 Azure 管道在 Azure VM 上远程运行一些 PowerShell 命令。在我的虚拟机上,WinRM 配置了自签名证书,并且在 VM 防火墙上打开了端口 5986。在 VM 中,我可以通过 Test_setup_unattended.bat 执行 PowerShell 脚本并安装应用程序。但是,当我使用 AZDO 发布管道在目标机器上通过 Powershell 脚本运行相同的脚本时,目标机器上没有任何反应。有人可以帮我吗?

这是我使用 PowerShell 在 VM 中运行的脚本:

$fol = "C:\Program Files\Test"    
Set-Location $fol    
Start-Process Test_setup_unattended.bat -Wait

标签: powershellbatch-filecommand-lineazure-devopsstart-process

解决方案


推荐阅读