MID サーバーでの PowerShell スクリプトの呼び出しSummaryこの例では、MID サーバーの相対パス scripts\ に格納されている PowerShell スクリプトを呼び出すスケジュール済みジョブを作成します。Instructions1.PowerShell スクリプトの例: #Variables: $arg1 = $args[0] $arg2 = $args[1] #Do some processing $DisplayName = $arg1 $arg2 #Display output WriteHost "Display name output: " $DisplayName 2.PowerShell スクリプトを MID サーバーフォルダーパス scrips に保存します。 3.MID サーバーが処理できるように、ECC キューレコードを挿入する次のスクリプトをインスタンスに作成します。 var arg1 = "variable 1"; var arg2 = "variable 2"; var ecc = new GlideRecord("ecc_queue"); ecc.initialize();//to create record ecc.agent = "mid.server.YOUR_MIDSERVER_NAME"; ecc.topic = "Command"; var value = "powershell scripts\\myScript.ps1 "+arg1+ " " +arg2; ecc.payload = '<?xml version="1.0" encoding="UTF-8"?><parameters><parameter name="name" value="'+value+'"/><parameter name="skip_sensor" value="true"/></parameters>'; ecc.queue = "output"; ecc.state = "ready"; ecc.insert(); 4.レコードが処理されると、スクリプトの結果が ECC キュー入力に書き込まれます。