petripaavola / IntuneDeviceDetailsGUI

Intune Device Details GUI
MIT License
244 stars 27 forks source link

Crash in VSCode & PowerShell 7 #5

Closed NekoJonez closed 1 month ago

NekoJonez commented 1 year ago

When using PowerShell 7 & VSCode, I get this error:

`Update-MSGraphEnvironment: C:\Users------\Desktop\Powershell\Powershell\IntuneDeviceDetailsGUI-main\IntuneDeviceDetailsGUI-main\IntuneDeviceDetailsGUI.ps1:5057:1 Line | 5057 | Update-MSGraphEnvironment -SchemaVersion 'beta' | ~~~~~ | The term 'Update-MSGraphEnvironment' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that | the path is correct and try again. Failed to update MSGraph Environment schema to Beta!

Make sure you have installed Intune Powershell module You can install Intune module to your user account with command: Install-Module -Name Microsoft.Graph.Intune -Scope CurrentUser

or you can install machine-wide Intune module with command: Install-Module -Name Microsoft.Graph.Intune`

After a bit of looking online, it's a conflict with Powershell 7. I'm going to create a PR that fixes this issue.

petripaavola commented 1 month ago

Actually bigger problem is that Graphical UI (Windows Presentation Framework) scripts work only with Windows Powershell.

Script now checks Powershell version and does not run in Powershell 7.

NekoJonez commented 1 month ago

Going to close this then.