Coming from a bash background, PowerShell is consistently annoying. Here's an example, passing an XML file to a cmdlet:
Some-Command -Param1 -FileData .\foobar.xml
Cannot process argument transformation on parameter 'FileData'. Cannot convert value ".\foo.xml" to type "System.Byte[]". Error: "Cannot convert value ".\foo.xml" to type "System.Byte". Error: "Input string was not in a correct format.""
In bash you would just do:
somecommand < foobar.xml
Instead you have to create an object and, do a conversion:
In bash you would just do:
Instead you have to create an object and, do a conversion: Then, run the same command using that object instead of the file: