Closed jonathansmyth1 closed 3 weeks ago
Hi @jonathansmyth1,
While the script is technically usable with PowerShell 5.1, I would highly recommend using PowerShell 7 for this. It would avoid this kind of issues I've personally ran into on various occasions (not only with IntuneAssignmentChecker).
EDIT: The problem you have described is due to the brackets ([
and ]
) inside Write-Host
. PowerShell 5.1 has troubles dealing with that.
I had no issues running this script under PowerShell 7.4.4 and onward.
Besides, Microsoft tends to push more of their tools and modules towards PowerShell 7 nowadays. So it's a good practice to start using and migrating to PS7, when possible.
Just my two-cents!
Hi @jonathansmyth1,
While the script is technically usable with PowerShell 5.1, I would highly recommend using PowerShell 7 for this. It would avoid this kind of issues I've personally ran into on various occasions (not only with IntuneAssignmentChecker).
EDIT: The problem you have described is due to the brackets (
[
and]
) insideWrite-Host
. PowerShell 5.1 has troubles dealing with that.I had no issues running this script under PowerShell 7.4.4 and onward.
Besides, Microsoft tends to push more of their tools and modules towards PowerShell 7 nowadays. So it's a good practice to start using and migrating to PS7, when possible.
Just my two-cents!
Hi @BatisteDONDOGLIO , Thanks for your help. Every day I learn something new :)
Thanks @jonathansmyth1
I've added #Requires -Version 7.0
to clarify that PowerShell 7 is required for this script to run.
Hi, I just wanted to let you know that when I tried to run your script as published, I got various errors such as: Unexpected token 'or' in expression or statement. Missing closing ')' in expression. The Try statement is missing its Catch or Finally block. Etc. I'll attach a screenshot too. The problem was due to the fancy 'Tick' and 'X' characters in lines 145 and 149. Once I deleted the [tick] and [x] from the script, it ran flawlessly. Thank you very much for the script, even if it needed a tweak from me! I hate Intune so anything which makes it more navigable is like manna from heaven for me.