My client's PowerShell scripts aren't working for a new user who happens to have a single-quote in their name - which means their profile path is called "C:\Users\Liam'OReilly". It appears to be a bug in the PowerShell class system.
Create a folder called "C:\Temp'Test" and add Test.ps1:
Write-Host "Test"
Class MyClass {}
Execute this script and you get this error:
The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) At line:1 char:1 + & 'C:\Temp''Test\Test..ps1' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], FileLoadException + FullyQualifiedErrorId : System.IO.FileLoadException
Rename the folder as simply C:\Test and it runs without an error.
Anyone got a workaround and what would be the best way to report this bug?
My workaround right now (as the user starts on Monday) is to remove the single-quote character from their display name in Office 365 which isn't ideal.