I see what you mean.
Ok, it's true, event ID 4104 does include a SID but it is located in the
System/Security/UserID field of the XML. Currently, this is not parsed by Wazuh as you can see raised here already in this issue:
So, you've found an architectural limitation of the Wazuh agent.
You can subscribe to that issue, comment on it, or even create a new one for your case. However, if I'm interpreting your needs correctly, even if that Security UserID attribute were extracted, you would still need to correlate with another event such as event ID 4688 (process creation) or such as Sysmon event ID 1 as mentioned before to get a better context.
To correlate alerts, you can create a custom rule that triggers if both event ID 4104 and event ID 4688 (or the Sysmon event) have triggered within a given period of time. You'll be using this rule parameters in your custom rule for this.
And it could look something similar to this (an untested example, just for your reference):
<group name="windows,">
<rule id="100100" level="5">
<if_sid>91801</if_sid>
<field name="win.system.eventID">4104</field>
<description>PowerShell ScriptBlock executed</description>
</rule>
<rule id="100101" level="5">
<if_sid>6001</if_sid>
<field name="win.system.eventID">4688</field>
<description>Process created by user $(win.eventdata.subjectUserName)</description>
</rule>
<rule id="100102" level="10" frequency="1" timeframe="10">
<if_sid>100101</if_sid>
<if_matched_sid>100100</if_matched_sid>
<same_field>win.system.processID</same_field>
<description>Correlated: PowerShell script execution with process creation $(win.system.processID) by user $(win.eventdata.subjectUserName)</description>
</rule>
</group>
But the events triggering order does matter and the user details might be available on alert 100101 only.
Let me know if this kind of approach could work for you. Thanks.