MEMOEXP

Our System Center Memo

SCSM Workflow Error, Invalid Character In The Given Encoding

When saving a workflow with a Power Shell Script, an error like the screenshot below might appear even though it works when you paste it directly in the Power Shell Window. This error is easily rectified though.

image

 

Why This Happens

This is actually due to special characters getting pasted wrongly into the system, for example or " . Try this. When typing the script in lets say a web or MS Word, special characters especially – or " might be changed. Typing a word in MS Word followed by a dash and then another word and a space, you’ll notice that the dash changes. By copying these changed special characters, Authoring Tool will prompt the error when we try to save the workflow. If you’re copying a script from the web this is even more prone to happen.

 

Solution

Make sure all the special characters are correct. Replace all your – and " by perhaps retyping them in the script. If your script is very long, try using Microsoft Word and use the search and replace function. Do this, and the problem should be resolved.

Advertisements

April 22, 2011 - Posted by | System Center Service Manager (SCSM)

4 Comments »

  1. Thanks for this. I am new to coding and this helped.

    Comment by Karen | November 11, 2011 | Reply

    • You’re welcome Karen, glad this helps 🙂

      Comment by James | November 13, 2011 | Reply

  2. I am having this issue, and I am copying and pasting from Notepad… Any ideas? I created the script in the Powershell ISE, and saved it. Opened the script in notepad and copied it into the PowerShell activity in the authoring tool.

    Comment by Josh | November 28, 2012 | Reply

    • Try removing those special characters and adding them back manually, this is the surest way to get rid of this error. Take note on characters such as – and “. Even if they look correct, manually delete and add them back.

      Comment by James | June 23, 2013 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: