VBScript does delivers an “Illegal Argument” message when trying to write the text shown below to file using the following code. If I change resultStr to some test text, it works. What could be the problem?
Set resFile = fs.CreateTextfile(resFilePath, true)
resFile.write resultStr
resFile.close
Contents of resultStr:

Your string looks like it contains non-ASCII characters. You need to pass an extra
Trueargument toCreateTextfileto open the text file using a Unicode encoding (probably UTF-16 on Windows).If you want to write UTF-8 to the file, see Writing UTF8 text to file.