<%#
  The default create_pipeline template wraps everything within an Invoke-Expression call, treating the command as a
  string, but that doesn't work for the Exchange environment.
%>
<Obj RefId="0">
  <MS>
    <Obj N="PowerShell" RefId="1">
      <MS>
        <Obj N="Cmds" RefId="2">
          <TN RefId="0">
            <T>System.Collections.Generic.List`1[[System.Management.Automation.PSObject, System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T>
            <T>System.Object</T>
          </TN>
          <LST>
            <Obj RefId="3">
              <MS>
                <S N="Cmd"><%= cmdlet.encode(xml: :text) %></S>
                <B N="IsScript">false</B>
                <Nil N="UseLocalScope" />
                <Obj N="MergeMyResult" RefId="4">
                  <TN RefId="1">
                    <T>System.Management.Automation.Runspaces.PipelineResultTypes</T>
                    <T>System.Enum</T>
                    <T>System.ValueType</T>
                    <T>System.Object</T>
                  </TN>
                  <ToString>None</ToString>
                  <I32>0</I32>
                </Obj>
                <Obj N="MergeToResult" RefId="5">
                  <TNRef RefId="1" />
                  <ToString>None</ToString>
                  <I32>0</I32>
                </Obj>
                <Obj N="MergePreviousResults" RefId="6">
                  <TNRef RefId="1" />
                  <ToString>None</ToString>
                  <I32>0</I32>
                </Obj>
                <Obj N="MergeError" RefId="7">
                  <TNRef RefId="1" />
                  <ToString>None</ToString>
                  <I32>0</I32>
                </Obj>
                <Obj N="MergeWarning" RefId="8">
                  <TNRef RefId="1" />
                  <ToString>None</ToString>
                  <I32>0</I32>
                </Obj>
                <Obj N="MergeVerbose" RefId="9">
                  <TNRef RefId="1" />
                  <ToString>None</ToString>
                  <I32>0</I32>
                </Obj>
                <Obj N="MergeDebug" RefId="10">
                  <TNRef RefId="1" />
                  <ToString>None</ToString>
                  <I32>0</I32>
                </Obj>
                <Obj N="Args" RefId="11">
                  <TNRef RefId="0" />
                  <LST>
                    <% args.each_with_index do |arg, index| %>
                    <%# start indexing arguments at 100 to be above the index numbers used by everything else %>
                    <Obj RefId="<%= 100 + index %>">
                      <MS>
                        <S N="N"><%= arg[:name].encode(xml: :text) %></S>
                        <% if arg[:value].nil? %>
                        <Nil N="V" />
                        <% elsif arg[:value].is_a?(TrueClass) || arg[:value].is_a?(FalseClass) %>
                        <B N="V"><%= arg[:value].to_s %></B>
                        <% elsif arg[:value].is_a? String %>
                        <S N="V"><%= arg[:value].encode(xml: :text) %></S>
                        <% elsif arg[:value].is_a? Nokogiri::XML::Element %>
                        <%= arg[:value].to_s %>
                        <% end %>
                      </MS>
                    </Obj>
                    <% end %>
                  </LST>
                </Obj>
              </MS>
            </Obj>
          </LST>
        </Obj>
        <B N="IsNested">false</B>
        <Nil N="History" />
        <B N="RedirectShellErrorOutputPipe">true</B>
      </MS>
    </Obj>
    <B N="NoInput">true</B>
    <Obj N="ApartmentState" RefId="23">
      <TN RefId="2">
        <T>System.Threading.ApartmentState</T>
        <T>System.Enum</T>
        <T>System.ValueType</T>
        <T>System.Object</T>
      </TN>
      <ToString>Unknown</ToString>
      <I32>2</I32>
    </Obj>
    <Obj N="RemoteStreamOptions" RefId="24">
      <TN RefId="3">
        <T>System.Management.Automation.RemoteStreamOptions</T>
        <T>System.Enum</T>
        <T>System.ValueType</T>
        <T>System.Object</T>
      </TN>
      <ToString>0</ToString>
      <I32>0</I32>
    </Obj>
    <B N="AddToHistory">true</B>
    <Obj N="HostInfo" RefId="25">
      <MS>
        <B N="_isHostNull">true</B>
        <B N="_isHostUINull">true</B>
        <B N="_isHostRawUINull">true</B>
        <B N="_useRunspaceHost">true</B>
      </MS>
    </Obj>
    <B N="IsNested">false</B>
  </MS>
</Obj>
