After having installed the PowerBI module for Powershell, I got this ‘System.Runtime.InteropServices.OSPlatform’ error
Login-PowerBIServiceAccount : Could not load type ‘System.Runtime.InteropServices.OSPlatform’ from assembly ‘netstandard, Version=126.96.36.199, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’.
The same error occurred with cmdlet Connect-PowerBIServiceAccount.
It appeared to be a dependency problem with .NET Framework 4.6. Unfortunately, you are required to download and install .NET 4.7 to fix this issue. Reboot afterwards.
Note: Don’t forget to install the module first with install-module cmdlet. Either with Administrative Rights. or with Scope CurrentUser:
PS D:\Install-Module -Name MicrosoftPowerBIMgmt.Workspaces
Install-Module : Administrator rights are required to install modules in ‘C:\Program Files\WindowsPowerShell\Modules’. Log on to the computer with an account that has
Administrator rights, and then try again, or install ‘C:\Users\User1\Documents\WindowsPowerShell\Modules’ by adding “-Scope CurrentUser” to your command. You can
also try running the Windows PowerShell session with elevated rights (Run as Administrator).