powerbi-powershell: Get-PowerBIWorkspace : Attempted to access an element as a type incompatible with the array
i have upgraded to latest version, but i recevie the error :

`PS C:> $allWS=Get-PowerBIWorkspace -Scope Organization -All Get-PowerBIWorkspace : Attempted to access an element as a type incompatible with the array. At line:1 char:8
- $allWS=Get-PowerBIWorkspace -Scope Organization -All
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : WriteError: (Microsoft.Power…owerBIWorkspace:GetPowerBIWorkspace) [Get-PowerBIWorkspace], ArrayTypeMismatchException
- FullyQualifiedErrorId : Attempted to access an element as a type incompatible with the array.,Microsoft.PowerBI.Commands.Workspaces.GetPowerBIWorkspace`
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 17 (4 by maintainers)
I am having the same issue, and it just started within the last few days. Before that everything was working fine. I’m using PS 5.1 in VS Code 1.56.2, not PS Core as there are issues with the MicrosoftPowerBIMgmt module in Core. I tried updating the MicrosoftPowerBIMgmt module, but the issue persists.
It seems to be related to using VS Code because I can run my scripts in Windows PowerShell and PowerShell ISE without receiving this error, but they fail when working from within VS Code.
When I run
[Newtonsoft.Json.JsonConvert].Modulein VS Code I get the below. This is not coming from Windows PowerShell as expected per the above comment.When I run
[Newtonsoft.Json.JsonConvert].Modulefrom within Windows PowerShell I get the below, which is expected.