无法在Windows minion(2008r2)上从salt-master执行powershell脚本:

时间:2015-11-28 06:50:27

标签: powershell salt-stack

我尝试从salt-master执行powershell脚本到我的Windows minion(win2008r2),结果显示True和Succeeded:1(更改= 1),note.ps1包含“Start-Process”C:\ windows \ system32 \ Notepad.exe的“

# cat note.sls
win_script:
 cmd.run:
  - name: powershell.exe -ExecutionPolicy ByPass -File C:\Users\Administrator\Desktop\note.ps1

# salt 'win2008r2' state.sls note
win2008r2:
----------
      ID: win_script
Function: cmd.run
    Name: powershell.exe -ExecutionPolicy ByPass -File C:\Users\Administrator\Desktop\note.ps1
  Result: True
 Comment: Command "powershell.exe -ExecutionPolicy ByPass -File C:\Users\Administrator\Desktop\note.ps1" run
 Started: 22:30:55.178000
Duration: 4774.0 ms
 Changes:
          ----------
          pid:
              2844
          retcode:
              0
          stderr:
          stdout:

Summary for win2008r2
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time:   4.774 s

# cat note.sls
win_script:
 cmd.run:
  - name: C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe -File C:\Users\Administrator\Desktop\note.ps1


# salt 'win2008r2' state.sls note
win2008r2:
----------
      ID: win_script
Function: cmd.run
    Name: C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe -File C:\Users\Administrator\Desktop\note.ps1
  Result: True
 Comment: Command "C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe -File C:\Users\Administrator\Desktop\note.ps1" run
 Started: 22:43:27.207000
Duration: 250.0 ms
 Changes:
          ----------
          pid:
              2308
          retcode:
              0
          stderr:
              File C:\Users\Administrator\Desktop\note.ps1 cannot be loaded because the execu
              tion of scripts is disabled on this system. Please see "get-help about_signing"
               for more details.
                  + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordE
                 xception
                  + FullyQualifiedErrorId : RuntimeException
          stdout:

Summary for win2008r2
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time: 250.000 ms

如果我在windows minion上执行上述命令manaully,我们可以打开记事本,但无法通过salt-master找到结果。

0 个答案:

没有答案