Hello @Toror72 ,
As @Rich Matheisen mentioned , you would require to use single quotes with the string .
New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\SrpV2\Exe\11759873-1713-4c87-b95b-925c887337a5" -Name "Value" -Value '<FilePublisherRule Id="11759873-1713-4c87-b95b-925c887337a5" Name="MICROSOFT DYNAMICS 365 COMMERCE, from O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" Description="R" UserOrGroupSid="S-1-1-0" Action="Allow"><Conditions><FilePublisherCondition PublisherName="O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" ProductName="MICROSOFT DYNAMICS 365 COMMERCE" BinaryName=""><BinaryVersionRange LowSection="" HighSection="*"/></FilePublisherCondition></Conditions></FilePublisherRule>' -PropertyType "String"
The above works perfectly as you can see it in the output. The reg.exe does not take large values with spaces in the middle as such and hence gives Invalid syntax .
Hope this output helps. If the information is helpful , please do accept post from @Rich Matheisen as answer so that it helps other members of the community facing similar issue .
Thank you.