michevnew/PowerShell

Remove_User_O365_GroupsV2.ps1 first line issue...

Closed this issue · 3 comments

There appears to be a non-visible character in the first lines of your code. If you copy and paste it directly then try to run it, PowerShell ISE indicates issues with the Param Line itself. The first commented line does not even appear green in ISE.

If I copy / paste the Require lines to a text file editor and replace them in the file, then it executes properly.

Not sure what's happening. I can see that the first line is treated differently, but I cannot reproduce the copy/paste part. Looks to me like the GitHub viewer is making up crap. Or perhaps is the uploader, dunno.

If you switch to Raw view, or download the file directly, it runs just fine.

So the files actually start with the BOM header (239 187 191/0xEF 0xBB 0xBF), which seems to be added by default to all files I edit with the ISE. I tested by removing the first three bytes, and indeed the GitHub viewer changes behavior.
Though I'm not seeing any issues with the BOM header present when actually working with the files. What OS are you on, is UTF-8 support enabled therein?

I replaced all affected files with BOM-less versions. Still have to figure out how to force ISE to create such versions in the future...