共用方式為


管理組件問題

 

發佈時間: 2016年3月

適用於: System Center 2012 R2 Operations Manager, System Center 2012 - Operations Manager, System Center 2012 SP1 - Operations Manager

本主題說明管理組件和模組特有的問題。

ExecuteCommand 不支援管線運算子或別名

當您將別名或管線運算子搭配使用 ExecuteCommand 參數時,命令將會失敗。ExecuteCommand 參數不支援管線運算子、別名和殼層專用語法。

在設計為用來管理 UNIX 和 Linux 電腦的 System Center Operations Manager 管理組件中,ExecuteCommand 參數不會啟動殼層處理,因而導致自訂動作失敗。

針對下列每一種自訂動作類型,請使用 ExecuteCommand 參數或 ExecuteShellCommand 參數指定叫用命令引數的方式:

  • Microsoft.Unix.WSMan.Invoke.ProbeAction

  • Microsoft.Unix.WSMan.Invoke.WriteAction

  • Microsoft.Unix.WSMan.Invoke.Privileged.ProbeAction

  • Microsoft.Unix.WSMan.Invoke.Privileged.WriteAction

ExecuteCommand 參數會將命令列引數傳遞到主控台,但不會啟動殼層處理。

ExecuteShellCommand 參數會使用使用者的預設殼層,將命令列引數傳遞到殼層處理;這個殼層可支援管線、別名和殼層專用語法。

System_CAPS_note注意事項

ExecuteShellCommand 參數會使用執行命令之使用者的預設殼層。 如果您需要特定殼層,請使用 ExecuteCommand 參數,並以需要的殼層作為命令引數的首碼。

下列範例顯示如何使用 ExecuteCommandExecuteShellCommand 參數:

  • 若要將命令列引數傳遞到主控台而不啟動殼層處理:

    <p:ExecuteCommand_INPUT xmlns:p="https://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem"> <p:Command> service syslog status </p:Command> <p:timeout>10</p:timeout> </p:ExecuteCommand_INPUT>

  • 若要將命令列引數傳遞到參照明確殼層的殼層處理:

    <p:ExecuteCommand_INPUT xmlns:p="https://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem"> <p:Command> /bin/sh ps -ef syslog | grep -v grep </p:Command> <p:timeout>10</p:timeout> </p:ExecuteCommand_INPUT>

  • 若要將命令列引數傳遞到使用使用者的預設殼層的殼層處理:

    <p:ExecuteShellCommand_INPUT xmlns:p="https://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem"> <p:Command> uptime |  awk '{print $10}' |awk -F"," '{print $1}' </p:Command> <p:timeout>10</p:timeout> </p:ExecuteShellCommand_INPUT>