I have a script which creates a zip file and adds files to this. This works fine from PowerShell but when I add it to an SQL Job step it fails with Syntax error. It fails at the following line:
set-content $zipfilename (“PK” + [char]5 + [char]6 + ("$([char]0)" * 18))
Any ideas why this is failing from the SQL Job step?
It’s kind of overwrought syntax, so it’s hard to tell. Since you didn’t post the error message, I’m just guessing, but personally I’d get rid of all the string concatenation and just use double quotes and subexpressions. I’m also not sure what the [char] type forces are for.
What this is doing is forcing “5” to be of the type [char]. Is that what you intended?