2.2.2.24 WARNING_RECORD Message

The Data field of a PSRP message specifies a WARNING_RECORD message when the MessageType field has a value of 0x00041009.

In messages of this type, the Data field is UTF-8 encoded XML, equivalent to the XML created by serializing the InformationalRecord (section 2.2.3.16), which SHOULD have the following type names:

  • System.Management.Automation.WarningRecord

  • System.Management.Automation.InformationalRecord

  • System.Object

Example:

 <Obj RefId="0">
   <TN RefId="0">
     <T>System.Management.Automation.WarningRecord</T>
     <T>System.Management.Automation.InformationalRecord</T>
     <T>System.Object</T>
   </TN>
   <ToString>Warning message</ToString>
   <MS>
     <S N="InformationalRecord_Message">Warning message</S>
     <B N="InformationalRecord_SerializeInvocationInfo">true</B>
     <Obj N="InvocationInfo_BoundParameters" RefId="1">
       <TN RefId="1">
         <T>System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]</T>
         <T>System.Object</T>
       </TN>
       <DCT>
         <En>
           <S N="Key">Message</S>
           <S N="Value">Warning message</S>
         </En>
       </DCT>
     </Obj>
     <Obj N="InvocationInfo_CommandOrigin" RefId="2">
       <TN RefId="2">
         <T>System.Management.Automation.CommandOrigin</T>
         <T>System.Enum</T>
         <T>System.ValueType</T>
         <T>System.Object</T>
       </TN>
       <ToString>Runspace</ToString>
       <I32>0</I32>
     </Obj>
     <B N="InvocationInfo_ExpectingInput">false</B>
     <S N="InvocationInfo_InvocationName">write-warning</S>
     <S N="InvocationInfo_Line"></S>
     <I32 N="InvocationInfo_OffsetInLine">0</I32>
     <Obj N="InvocationInfo_PipelineIterationInfo" RefId="3">
       <TN RefId="3">
         <T>System.Int32[]</T>
         <T>System.Array</T>
         <T>System.Object</T>
       </TN>
       <LST>
         <I32>0</I32>
         <I32>1</I32>
       </LST>
     </Obj>
     <I32 N="InvocationInfo_PipelineLength">1</I32>
     <I32 N="InvocationInfo_PipelinePosition">1</I32>
     <S N="InvocationInfo_PositionMessage"></S>
     <I32 N="InvocationInfo_ScriptLineNumber">0</I32>
     <S N="InvocationInfo_ScriptName"></S>
     <Obj N="InvocationInfo_UnboundArguments" RefId="4">
       <TN RefId="4">
         <T>System.Collections.Generic.List`1[[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]</T>
         <T>System.Object</T>
       </TN>
       <LST />
     </Obj>
     <Obj N="CommandInfo_CommandType" RefId="5">
       <TN RefId="5">
         <T>System.Management.Automation.CommandTypes</T>
         <T>System.Enum</T>
         <T>System.ValueType</T>
         <T>System.Object</T>
       </TN>
       <ToString>Cmdlet</ToString>
       <I32>8</I32>
     </Obj>
     <S N="CommandInfo_Definition">Write-Warning [-Message] &lt;String&gt; [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;]_x000D__x000A_</S>
     <S N="CommandInfo_Name">Write-Warning</S>
     <Obj N="CommandInfo_Visibility" RefId="6">
       <TN RefId="6">
         <T>System.Management.Automation.SessionStateEntryVisibility</T>
         <T>System.Enum</T>
         <T>System.ValueType</T>
         <T>System.Object</T>
       </TN>
       <ToString>Public</ToString>
       <I32>0</I32>
     </Obj>
     <Obj N="InformationalRecord_PipelineIterationInfo" RefId="7">
       <TN RefId="7">
         <T>System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]</T>
         <T>System.Object</T>
       </TN>
       <LST>
         <I32>0</I32>
         <I32>1</I32>
       </LST>
     </Obj>
   </MS>
 </Obj>