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: ( [], 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!