Script converted to EXE displays "Missing closing '}'

I wrote a script that utilizes WinForms (love the editor for it) and the resulting EXE always displays the following error when run from the console:

Missing closing β€˜}’ in statement block or type definition.

    • CategoryInfo : ParserError: (:slight_smile: [], ParentContainsErrorRecordEx*
  • ception*
    • FullyQualifiedErrorId : MissingEndCurlyBrace*

Using PowerShell 5.1 on Windows 10 Enterprise.

I created a very simple script as well, and it did the same thing:

Function Write-OwDate {

  • [CmdletBinding()]*
  • param([string]$f_logtext)*
  • $LogText = β€˜[’+(Get-Date -format β€˜yyyy-MM-dd HH:mm:ss.ffff’)+’] '+$f_logtext*
  • Write-Output $LogText*
    } # Function Write-OwDate

Write-OwDate β€œBLAAAAAAAH”

This would lead me to believe that there is something wonky with my environment.

I tried it on my home machine and it tried to import the profile.ps1 (it gives errors that it cannot run it due to workstation restrictions) but it does display the β€œBLAAAAAH”

The WinForms script uses the ConfigurationManager module, so I specified in the Package.psd1 to not package the modules (if the IgnoredModules worked, that would be wonderful …)

The PSD1:

Root = β€˜c:\Users\testuser\OneDrive - Enterprise 365\Scripts\Test\Test.ps1’
OutputPath = β€˜c:\Users\testuser\OneDrive - Enterprise 365\Scripts\Test\out’
Package = @{
Enabled = $true
Obfuscate = $false
HideConsoleWindow = $false
DotNetVersion = β€˜v4.6.2’
FileVersion = β€˜1.0.0’
FileDescription = β€˜β€™
ProductName = β€˜β€™
ProductVersion = β€˜β€™
Copyright = β€˜β€™
RequireElevation = $false
ApplicationIconPath = β€˜β€™
PackageType = β€˜Console’
Bundle = @{
Enabled = $true
Modules = $false
# IgnoredModules = @()

Any ideas? Thank you in advance for any assistance!

Can you send me the resulting exe that is building on the machine where it doesnt work? You can send me a private message on here with a Firefox Send link if you like.