如何使用Ansible在远程Windows计算机上执行exe文件?我使用了原始模块、脚本模块和命令模块,但问题是,exe文件运行在不同的会话中,无法在远程计算机的桌面上看到应用程序UI。
第二个问题是,在执行exe后,ansible剧本不会向前移动。
我们能在活动桌面会话中运行exe吗?
发布于 2015-02-03 22:06:38
我可以用psexec解决这些问题。
#Creating the credential for the invoke-command.
$strScriptUser = "COMPUTERNAME\USer"
$strPass = "PASSWORD"
$PSS = ConvertTo-SecureString $strPass -AsPlainText -Force
$cred = new-object system.management.automation.PSCredential $strScriptUser,$PSS
#Invoke-Command to call the psexec to start the application.
invoke-command -Computer "." -Scriptblock {
c:\AnsibleTest\ps\psexec.exe -accepteula -d -h -i 1 -u COMPUTERNAME\USER -p PASSWORD PATH_TO_THE_EXE\PROGRAM.EXE
} -Credential $cred发布于 2017-08-21 17:50:54
您可以为此使用win_psexec模块。
module.html
https://stackoverflow.com/questions/28230063
复制相似问题