AskTechGurus Get help now →

PowerShell & Scripting Errors

Pasted PowerShell script throws parser errors with strange characters

A script that looks fine throws parser errors, and the error shows odd characters like â€" where dashes or quotes were. It happened after copying the script from a web page or document.

What you’re seeing

  • Parser errors such as "missing terminator", "unexpected token" or "missing closing brace" in a script that looks correct.
  • Odd sequences like â€" or “ appearing in the error message where a dash or quotation mark should be.
  • The script was copied from a blog post, Word document, PDF, email or chat message just before it broke.
  • Parameters that start with a dash are not recognized, or a string seems to run on to the end of the file.
  • The same script downloaded as a file runs fine, but the pasted version fails.

Common causes

Every environment is different, but these are the causes our engineers find most often:

  • Word processors and websites automatically convert straight quotes into curly "smart" quotes and hyphens into en or em dashes.
  • The file was saved as UTF-8 without a byte order mark, and Windows PowerShell 5.1 read it as an older Windows code page, mangling any non-ASCII characters.
  • Invisible characters such as non-breaking spaces or zero-width spaces came along with the copied text.
  • Line breaks were altered during copying, splitting a command or joining two lines together.
  • The editor used to save the script applied a different encoding from the one PowerShell expects.

Why it matters

These errors waste a surprising amount of time because the script looks perfect on screen. Admins can spend an afternoon chasing a problem that is really one wrong character. Worse, a partially working script may run some lines and skip others, leaving user accounts, permissions or mailboxes half-changed. For businesses that rely on shared snippets and vendor instructions, a dependable way to keep scripts clean protects both time and the consistency of changes made to production systems.

How AskTechGurus fixes it

Skip the trial and error. A certified engineer works on your actual system, finds the root cause, and fixes it properly.

Tell us what’s happening

Submit a ticket in about two minutes. Paste the error, describe what changed, and pick your tier. No charge to submit.

A certified engineer diagnoses it

A vetted, US-based systems engineer claims your ticket, usually within minutes during business hours, and investigates over a secure remote session you can watch and end at any time.

Fixed and verified with you

The engineer resolves the root cause and confirms with you that it’s working. You don’t just get a workaround, and you get a plain-English summary of what was wrong.

Pay only when it’s resolved

Fixed price from $99, invoiced only after you approve the fix. If it isn’t resolved, you don’t pay.

Frequently asked questions

Could a partially failed script have changed anything?

Yes, depending on where it stopped. An engineer can review what the script was meant to do and confirm which parts actually ran before anything is rerun.

Why does it look fine when I open the file?

Curly quotes, typographic dashes and invisible spaces look almost identical to the plain characters PowerShell needs. The difference only shows up when the parser reads the file.

Can this happen with scripts we write ourselves?

It can, especially when scripts are drafted in documents, emailed or pasted into tickets. The editor and the way files are saved make a big difference.

Still stuck? Let a pro take it from here.

AskTechGurus connects you with vetted, US-based systems engineers who fix this every day. No call centers, no scripts, no surprise bills.

Start now →