问题描述
我有一个 PowerShell 脚本,它在本地执行时可以从本地服务器运行另一个脚本,并在标准文本文件中生成结果。
但是,当我通过 Ansible Runbook 运行相同的脚本时,没有产生任何结果
PowerShell 脚本是-
# runcis.ps1
# Import DBA functions
# Construct local instance name and execute Getter script,format output and redirect to
# a text file on the local server
.\ImportAllLmesqlDbaFunctions.ps1
$inst = (get-itemproperty 'HKLM:\SOFTWARE\Microsoft\Microsoft sql Server').InstalledInstances
$instance = "$env:COmpuTERNAME\$inst"
Get-CISAdHocdistQueries -Instances $instance| format-table -AutoSize > c:\cis\output.txt
Ansible Runbook 是-
---
# Below will create directory if not existing
- name: copy Powershell scripts to Remote Server
copy:
src: cis
dest: c:\
- name: Run CIS powershell script on the Remote Server
win_shell: C:\cis\runcis.ps1
非常感谢您的帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)