[GH-ISSUE #140] JSON error on getting email addresses #66

Closed
opened 2026-02-27 20:31:04 +03:00 by kerem · 18 comments
Owner

Originally created by @psic4t on GitHub (Aug 14, 2025).
Original GitHub issue: https://github.com/Set-OutlookSignatures/Set-OutlookSignatures/issues/140

Originally assigned to: @psic4t, @GruberMarkus on GitHub.

Issue happens in the latest release

  • I confirm that the issue happens in the latest release of Set-OutlookSignatures

Previously solved issues and documentation

  • I have searched through issues, discussions and documentation, but have not found an answer to my issue

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happens?

When using Outlook-New the script errors here:

Get email addresses @2025-08-14T14:43:23+02:00@
  Get email addresses from New Outlook and Outlook Web, as New Outlook is set as default
ConvertFrom-Json : Ungültiger JSON-Primitiv: .
In C:\temp\Set-OutlookSignatures\Set-OutlookSignatures.ps1:1795 Zeichen:193
+ ... ldPath '\Microsoft\Olk\UserSettings.json') | ConvertFrom-Json).Identi ...
+                                                  ~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand

UserSettings.json looks fine, only one mail address as identifier. Any ideas?

Set-OutlookSignatures_Log_20250814T1253372529Z.txt

Originally created by @psic4t on GitHub (Aug 14, 2025). Original GitHub issue: https://github.com/Set-OutlookSignatures/Set-OutlookSignatures/issues/140 Originally assigned to: @psic4t, @GruberMarkus on GitHub. ### Issue happens in the latest release - [x] I confirm that the issue happens in the latest release of Set-OutlookSignatures ### Previously solved issues and documentation - [x] I have searched through issues, discussions and documentation, but have not found an answer to my issue ### Code of Conduct - [x] I agree to follow this project's Code of Conduct ### What happens? When using Outlook-New the script errors here: ``` Get email addresses @2025-08-14T14:43:23+02:00@ Get email addresses from New Outlook and Outlook Web, as New Outlook is set as default ConvertFrom-Json : Ungültiger JSON-Primitiv: . In C:\temp\Set-OutlookSignatures\Set-OutlookSignatures.ps1:1795 Zeichen:193 + ... ldPath '\Microsoft\Olk\UserSettings.json') | ConvertFrom-Json).Identi ... + ~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [ConvertFrom-Json], ArgumentException + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand ``` UserSettings.json looks fine, only one mail address as identifier. Any ideas? [Set-OutlookSignatures_Log_20250814T1253372529Z.txt](https://github.com/user-attachments/files/21773445/Set-OutlookSignatures_Log_20250814T1253372529Z.txt)
kerem 2026-02-27 20:31:04 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@GruberMarkus commented on GitHub (Aug 14, 2025):

@psic4t, could you please share the JSON file?

<!-- gh-comment-id:3188372506 --> @GruberMarkus commented on GitHub (Aug 14, 2025): @psic4t, could you please share the JSON file?
Author
Owner

@psic4t commented on GitHub (Aug 14, 2025):

Sure, here you go:

UserSettings.json

<!-- gh-comment-id:3188383569 --> @psic4t commented on GitHub (Aug 14, 2025): Sure, here you go: [UserSettings.json](https://github.com/user-attachments/files/21773588/UserSettings.json)
Author
Owner

@GruberMarkus commented on GitHub (Aug 14, 2025):

You are using v4.20.3. A newer version, v4.20.4, is available (but this should not change anything about the JSON error).

The JSON file you uploaded works correctly in my first Tests - but I have an assumption and it could be that GitHub is playing a trick on us here.

Please run the following two commands:

Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json') | ConvertFrom-Json

Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json') -replace '\r?\n', '\r\n' | ConvertFrom-Json

If my assumption is correct, the first command should fail and the second one should work.

If the second command also fails, please put the JSON file in a ZIP file and share the archive.

<!-- gh-comment-id:3188433866 --> @GruberMarkus commented on GitHub (Aug 14, 2025): You are using v4.20.3. A newer version, v4.20.4, is available (but this should not change anything about the JSON error). The JSON file you uploaded works correctly in my first Tests - but I have an assumption and it could be that GitHub is playing a trick on us here. Please run the following two commands: ``` Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json') | ConvertFrom-Json Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json') -replace '\r?\n', '\r\n' | ConvertFrom-Json ``` If my assumption is correct, the first command should fail and the second one should work. If the second command also fails, please put the JSON file in a ZIP file and share the archive.
Author
Owner

@GruberMarkus commented on GitHub (Aug 14, 2025):

Sorry, wrong parenthesis. Here is the correct code:

((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json')) | ConvertFrom-Json

((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json')) -replace '\r?\n', '\r\n') | ConvertFrom-Json
<!-- gh-comment-id:3188443092 --> @GruberMarkus commented on GitHub (Aug 14, 2025): Sorry, wrong parenthesis. Here is the correct code: ``` ((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json')) | ConvertFrom-Json ((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json')) -replace '\r?\n', '\r\n') | ConvertFrom-Json ```
Author
Owner

@psic4t commented on GitHub (Aug 14, 2025):

The corrected commands from your second post work like you assumed: First fails (closing bracket missing?) and second works. I zipped the settings file.

UserSettings.zip

<!-- gh-comment-id:3188463308 --> @psic4t commented on GitHub (Aug 14, 2025): The corrected commands from your second post work like you assumed: First fails (closing bracket missing?) and second works. I zipped the settings file. [UserSettings.zip](https://github.com/user-attachments/files/21774018/UserSettings.zip)
Author
Owner

@GruberMarkus commented on GitHub (Aug 14, 2025):

Please also test the following:

((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json') -Raw) | ConvertFrom-Json

((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json') -Raw) -replace '\r?\n', "`r`n") | ConvertFrom-Json
<!-- gh-comment-id:3188465426 --> @GruberMarkus commented on GitHub (Aug 14, 2025): Please also test the following: ``` ((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json') -Raw) | ConvertFrom-Json ((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json') -Raw) -replace '\r?\n', "`r`n") | ConvertFrom-Json ```
Author
Owner

@psic4t commented on GitHub (Aug 14, 2025):

Of course!

First does not work, second does work.

<!-- gh-comment-id:3188473179 --> @psic4t commented on GitHub (Aug 14, 2025): Of course! First does not work, second does work.
Author
Owner

@GruberMarkus commented on GitHub (Aug 14, 2025):

The first one does not work, because I missed something. Please run another complete scenario:

((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json') -Raw)) | ConvertFrom-Json
((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json') -Raw) -replace '\r?\n', "`r`n") | ConvertFrom-Json

((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json'))) | ConvertFrom-Json
((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json')) -replace '\r?\n', "`r`n") | ConvertFrom-Json

Lines 2 and 4 should work. This would hint towards my assumption that the JSON file uses UNIX-style linebreaks, which would be strange.

But if lines 1 and 3 also work, the problem is not the line break style in the JSON file, but likely in the result of ConvertEncoding. If this is the case, I might need to ask you for more tests.

Please make sure you use Windows PowerShell 5.1 for your tests, not PowerShell 6+.

A hint: The free and open-source version of Set-OutlookSignatures can read email addresses from New Outlook for Windows, but it can not deploy signatures to it (this is a feature of the Benefactor Circle add-on). To see the sample templates in your tests, you will need to switch to Classic Outlook for Windows.

<!-- gh-comment-id:3188504906 --> @GruberMarkus commented on GitHub (Aug 14, 2025): The first one does not work, because I missed something. Please run another complete scenario: ``` ((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json') -Raw)) | ConvertFrom-Json ((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json') -Raw) -replace '\r?\n', "`r`n") | ConvertFrom-Json ((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json'))) | ConvertFrom-Json ((Get-Content $(Join-Path -Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData)) -ChildPath '\Microsoft\Olk\UserSettings.json')) -replace '\r?\n', "`r`n") | ConvertFrom-Json ``` Lines 2 and 4 should work. This would hint towards my assumption that the JSON file uses UNIX-style linebreaks, which would be strange. But if lines 1 and 3 also work, the problem is not the line break style in the JSON file, but likely in the result of ConvertEncoding. If this is the case, I might need to ask you for more tests. Please make sure you use Windows PowerShell 5.1 for your tests, not PowerShell 6+. A hint: The free and open-source version of Set-OutlookSignatures can read email addresses from New Outlook for Windows, but it can not deploy signatures to it (this is a feature of the Benefactor Circle add-on). To see the sample templates in your tests, you will need to switch to Classic Outlook for Windows.
Author
Owner

@psic4t commented on GitHub (Aug 14, 2025):

All 4 lines are working. UNIX linebreaks would be strange as I'm testing on a default Win11 client notebook via RDP.

I actually don't know, what version of PowerShell Win11 comes with. It's a default client without any addons.

We are currently evaluating set-outlooksignatures as we need signatures for Outlook-New, Outlook Web and Outlook on mobile devices. Is there a test version of the Benefactor Circle add-on available?

<!-- gh-comment-id:3188528507 --> @psic4t commented on GitHub (Aug 14, 2025): All 4 lines are working. UNIX linebreaks would be strange as I'm testing on a default Win11 client notebook via RDP. I actually don't know, what version of PowerShell Win11 comes with. It's a default client without any addons. We are currently evaluating set-outlooksignatures as we need signatures for Outlook-New, Outlook Web and Outlook on mobile devices. Is there a test version of the Benefactor Circle add-on available?
Author
Owner

@psic4t commented on GitHub (Aug 14, 2025):

BTW: I had to manually set the "IsWindows" variable, as this was not present on Win11.

<!-- gh-comment-id:3188531223 --> @psic4t commented on GitHub (Aug 14, 2025): BTW: I had to manually set the "IsWindows" variable, as this was not present on Win11.
Author
Owner

@GruberMarkus commented on GitHub (Aug 14, 2025):

This points to a problem somewhere in ConvertEncoding. I need to investigate further.

Windows comes with Windows PowerShell 5.1, PowerShell 6+ requires manual installation.

IsWindows: Where did you get an error regarding the IsWindows variable? As it is not automatically available on Windows PowerShell, Set-OutlookSignatures defines it itself.

Yes, a 14-day trial version of the Benefactor Circle add-on is available at https://set-outlooksignatures.com/benefactorcircle/#trialversion.
It is recommended to first make sure that Set-OutlookSignatures runs, as the add-on really is just an add-on and not a standalone product.

<!-- gh-comment-id:3188552344 --> @GruberMarkus commented on GitHub (Aug 14, 2025): This points to a problem somewhere in ConvertEncoding. I need to investigate further. Windows comes with Windows PowerShell 5.1, PowerShell 6+ requires manual installation. IsWindows: Where did you get an error regarding the IsWindows variable? As it is not automatically available on Windows PowerShell, Set-OutlookSignatures defines it itself. Yes, a 14-day trial version of the Benefactor Circle add-on is available at https://set-outlooksignatures.com/benefactorcircle/#trialversion. It is recommended to first make sure that Set-OutlookSignatures runs, as the add-on really is just an add-on and not a standalone product.
Author
Owner

@psic4t commented on GitHub (Aug 14, 2025):

This points to a problem somewhere in ConvertEncoding. I need to investigate further.

Just let me know if I should test something.

IsWindows: Where did you get an error regarding the IsWindows variable? As it is not automatically available on Windows PowerShell, Set-OutlookSignatures defines it itself.

Strange, now I can't reproduce this error. I'll post a log if it occurs again.

<!-- gh-comment-id:3188567538 --> @psic4t commented on GitHub (Aug 14, 2025): > This points to a problem somewhere in ConvertEncoding. I need to investigate further. Just let me know if I should test something. > IsWindows: Where did you get an error regarding the IsWindows variable? As it is not automatically available on Windows PowerShell, Set-OutlookSignatures defines it itself. Strange, now I can't reproduce this error. I'll post a log if it occurs again.
Author
Owner

@GruberMarkus commented on GitHub (Aug 14, 2025):

You found a bug. Thank you for reporting it!

In the file Set-OutlookSignatures.ps1, search for

'\Microsoft\Olk\UserSettings.json') | ConvertFrom-Json

and change it to

'\Microsoft\Olk\UserSettings.json') -InIsHtml $false | ConvertFrom-Json

Please let me know if this solves your problem.

<!-- gh-comment-id:3188604335 --> @GruberMarkus commented on GitHub (Aug 14, 2025): You found a bug. Thank you for reporting it! In the file `Set-OutlookSignatures.ps1`, search for ``` '\Microsoft\Olk\UserSettings.json') | ConvertFrom-Json ``` and change it to ``` '\Microsoft\Olk\UserSettings.json') -InIsHtml $false | ConvertFrom-Json ``` Please let me know if this solves your problem.
Author
Owner

@GruberMarkus commented on GitHub (Aug 14, 2025):

also change

"\Microsoft\OneAuth\accounts\$($_.Value)") | ConvertFrom-Json

to

"\Microsoft\OneAuth\accounts\$($_.Value)") -InIsHtml $false | ConvertFrom-Json
<!-- gh-comment-id:3188609863 --> @GruberMarkus commented on GitHub (Aug 14, 2025): also change ``` "\Microsoft\OneAuth\accounts\$($_.Value)") | ConvertFrom-Json ``` to ``` "\Microsoft\OneAuth\accounts\$($_.Value)") -InIsHtml $false | ConvertFrom-Json ```
Author
Owner

@psic4t commented on GitHub (Aug 14, 2025):

Great, that solves it! Thanks a lot, the script seems to run sucessfully now.

So, to set the signature for anything other than Outlook Classic I need the Benefactor plugin? Is there any way I can check online If the script worked?

<!-- gh-comment-id:3188635848 --> @psic4t commented on GitHub (Aug 14, 2025): Great, that solves it! Thanks a lot, the script seems to run sucessfully now. So, to set the signature for anything other than Outlook Classic I need the Benefactor plugin? Is there any way I can check online If the script worked?
Author
Owner

@GruberMarkus commented on GitHub (Aug 14, 2025):

Thank you!

There will be some more checks on our side and a root cause analysis on why our test cases failed, but it is quite certain that an updated release will be published until the end of tomorrow (v4.20.5).

The new release will contain an entry like this in the changelog:

Fixed

  • Correct a problem reading email addresses from New Outlook for Windows. (#140) (Thanks @psic4t!)

Yes, you need the Benefactor Circle add-on to write signatures to Outlook Web and New Outlook.

You can preview the signatures the Benefactor Circle add-on would write by using the SimulateUser parameter. This writes the signatures to the folder defined with the AdditionalSignaturePath parameter. Or you temporarily switch to Classic Outlook for Windows.


Please let me know if this issue can be closed as successfully solved.

<!-- gh-comment-id:3188670667 --> @GruberMarkus commented on GitHub (Aug 14, 2025): # Thank you! There will be some more checks on our side and a root cause analysis on why our test cases failed, but it is quite certain that an updated release will be published until the end of tomorrow (v4.20.5). The new release will contain an entry like this in the changelog: ### Fixed - Correct a problem reading email addresses from New Outlook for Windows. (<a href="https://github.com/Set-OutlookSignatures/Set-OutlookSignatures/issues/140" target="_blank">#140</a>) (Thanks <a href="https://github.com/psic4t" target="_blank">@psic4t</a>!) ---------------- Yes, you need the Benefactor Circle add-on to write signatures to Outlook Web and New Outlook. You can preview the signatures the Benefactor Circle add-on would write by using the [SimulateUser](https://set-outlooksignatures.com/parameters/#16-simulateuser) parameter. This writes the signatures to the folder defined with the [AdditionalSignaturePath](https://set-outlooksignatures.com/parameters/#14-additionalsignaturepath) parameter. Or you temporarily switch to Classic Outlook for Windows. ---------------- Please let me know if this issue can be closed as successfully solved.
Author
Owner

@GruberMarkus commented on GitHub (Aug 15, 2025):

Solved in release v4.21.0, closing this issue.

<!-- gh-comment-id:3192628202 --> @GruberMarkus commented on GitHub (Aug 15, 2025): Solved in release [v4.21.0](https://github.com/Set-OutlookSignatures/Set-OutlookSignatures/releases), closing this issue.
Author
Owner

@psic4t commented on GitHub (Aug 19, 2025):

Seems to work for me. Thanks a lot!

<!-- gh-comment-id:3200355964 --> @psic4t commented on GitHub (Aug 19, 2025): Seems to work for me. Thanks a lot!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Set-OutlookSignatures-Set-OutlookSignatures#66
No description provided.