I'm new to PowerShell DSC and I'm writing a script that should ensure if a certain File is present with the correct content. It's fairly simple:
Ensure = "Present"
DestinationPath = $BatPath
Contents = "start $($FullPath)"
Type = "File"
When I open the file in notepad, the contents seem to be OK. However, when I execute it I get an error message:
'∩╗┐start' is not recognized as an internal or external command, operable program or batch file.
Suddenly there's these weird ∩╗┐ characters in the file! I assume this is some sort of encoding problem but I have no clue how to solve this. Does anyone know of a way to fix this?
EDIT: So apparently these characters are the Byte Order Mark (BOM) and don't show up in notepad due to encoding. See this topic.
My question is: Using the DSC File resource, can I write the file content without the BOM?
(Yes, I'm trying to create a Batch script in a PowerShell script. This may be weird, but not relevant to this question!)