Skip to content

Encoding Guidance for Signed PowerShell Scripts

support.microsoft.com • November 10, 2026

Starting with the November 2026 Windows security update, a stricter encoding validation for PowerShell script signing and signature verification is introduced. This intentional security-hardening change may cause affected scripts containing malformed UTF-8 to fail signature validation after the update, even if they previously validated successfully.

This guide explains the encoding scenarios that can affect signing or signature validation and provides steps to identify affected files, attempt temporary repair where supported, or convert and re-sign them. Not every signature failure is caused by encoding.

How Windows determines encoding

For file-based PowerShell script signing and signature verification, Windows selects an encoding before decoding the entire file:

A recognized byte order mark (BOM) identifies UTF-8 or UTF-16.

Without a BOM, Windows checks the first 32 bytes for encoding patterns, including UTF-16 and UTF-8. If no pattern matches, it uses the machine’s system code page .

Windows decodes the entire file using the selected encoding.

This hardening change strengthens validation during decoding; it does not change the encoding-selection process described above. Additionally, this hardening change causes Windows to reject malformed UTF-8 files that could previously be decoded using replacement characters. For affected files, signing might fail or an existing signature might be reported as NotSigned.

A UTF-8 file with an ASCII-only header can be read using a system code page, while a code-page file can be mistaken for UTF-8. A header that looks like UTF-8 does not establish that the rest of the file is valid UTF-8.

Adding a BOM alone does not correct invalid bytes. The long-term repair is to review the text, save it as valid UTF-8 with BOM, and sign the file again.

What symptoms might occur by this hardening change?

After installing the Windows security update released on and after November 10, 2026, files affected by this stricter encoding validation might exhibit the following symptoms:

These symptoms can also have other causes and do not, by themselves, confirm an encoding issue or establish that the update caused the failure. Run the tool in Scan mode as described in Step 1: Find affected scripts before attempting to repair a file.

This hardening change introduces stricter validation that may affect scripts containing invalid bytes in the encoding Windows selects. The scenarios below help identify potential encoding issues; not every script in these categories is affected.

The hardening change enforces stricter validation, not encoding selection. Use the steps below before choosing a repair option.

The Repair-SignedPowerShellUtf8.ps1 script helps identify encoding issues and create copies for repair or conversion. It never overwrites the source file or an existing output file.

Use -Path to select the input, -Recurse to scan subfolders, and -OutputPath to choose a repair or conversion destination. For conversion, -SourceCodePage specifies the file’s original encoding when needed. Commands are in the steps below; detailed parameter help is in the script’s opening .

Limits and cases the Repair script cannot handle

A repair is not guaranteed. Deploy a repaired copy only if its SignatureStatus is Valid . Review and test the copy before replacing the deployed script. If repair cannot restore a valid signature and you do not have the signing certificate, ask the publisher for a corrected, signed copy.

Save the full script from the appendix as Repair-SignedPowerShellUtf8.ps1 . Open Windows PowerShell 5.1 and run the commands from the folder containing it.

Use an approved copy of the script under your organization’s execution and App Control policies. The tool requires FullLanguage. If execution is blocked, follow your organization’s approval process rather than changing policy as a general setup step.

To sign a converted file, you need an approved code-signing certificate or access to your publisher’s signing process. Temporary Repair does not require the signing key.

Step 1: Find affected scripts

Run the tool in read-only Scan mode:

For a single file, set -Path to that file instead. Scan reports the potential encoding issue, current signature status, and suggested action without changing files. The following table helps you to understand the reported issue.

These labels are diagnostic hints, not proof of the intended source encoding.

Unsigned files: Scan checks both signed and unsigned files. NotSigned alone does not mean a file is affected, and Scan cannot establish whether it was previously signed. An unsigned file with an encoding issue may need conversion before signing, but it has no existing signature to preserve.

Step 2: Repair or convert affected scripts

Choose one of the following options for a file flagged by Scan. Conversion and re-signing are recommended. Temporary Repair may help with previously signed files in cases 1 and 2, but is not offered for case 3.

Recommended: Convert to UTF-8 with BOM and sign again

Create a UTF-8-with-BOM copy. The source remains unchanged, and the old signature is removed from the copy:

The default output is C:\Scripts\Deploy.utf8bom.ps1 . For case 3, specify the file’s known original encoding with -SourceCodePage ; for example, add -SourceCodePage 932 for a Shift-JIS file.

Review the converted text and correct any errors before signing. Use your organization’s approved signing process; the commands below assume $cert already contains your approved code-signing certificate:

Confirm Status : Valid and test the reviewed copy before deployment.

Temporary: Attempt a repair without re-signing

Repair attempts to create a copy whose existing signature validates. It does not reconstruct missing text or fix script errors, and some files cannot be repaired:

.\Repair-SignedPowerShellUtf8.ps1 -Mode Repair -Path C:\Scripts\Deploy.ps1

A successful repair reports:

For case 2, use a machine with the same system code page as the original signer.

Deploy the copy only after its SignatureStatus reports Valid and you have reviewed and tested it.