1

I moved from a computer to another one, I have the same version of Powershell installed but when it worked on my previous computer, on the new one I have this error when I launch a PS script:

In French :
New-Object : Le type [System.Windows.Forms.DataVisualization.Charting.Chart] est introuvable : vérifiez que l'assembly dans lequel il se trouve est chargé.

In English :
New-Object : The type [ System.Windows.Forms.DataVisualization.Charting.Chart ] not found : Ensure that the assembly in which it is loaded. (translation)

EDIT: .NET Versions

-PSChildName Version ----------- ------- 
v2.0.50727 2.0.50727.5420 
v3.0 3.0.30729.5420 Windows Communication Foundation 3.0.4506.5420 Windows Presentation Foundation 3.0.6920.5011 
v3.5 3.5.30729.5420 
Client 4.0.30319 
Full 4.0.30319
$PSVersionTable

Name                           Value
----                           -----
CLRVersion                     2.0.50727.5485
BuildVersion                   6.1.7601.17514
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1

EDIT:
This is the requsted result :

-PSChildName                                                 Version
-----------                                                 -------
v2.0.50727                                                  2.0.50727.5420
v3.0                                                        3.0.30729.5420
Windows Communication Foundation                            3.0.4506.5420
Windows Presentation Foundation                             3.0.6920.5011
v3.5                                                        3.5.30729.5420
Client                                                      4.0.30319
Full                                                        4.0.30319
GitaarLAB
  • 13,494
  • 9
  • 51
  • 74

1 Answers1

0

Use following script, taken from here, to see which .Net version are installed. System.Windows.Forms.DataVisualization.Charting.Chart is only available at .Net 4.0 and 4.5. You may need to install one of them.

Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |
Get-ItemProperty -name Version -EA 0 |
Where { $_.PSChildName -match '^(?!S)\p{L}'} |
Select PSChildName, Version

Also look which version of .Net, your powershell is using.

$psversiontable

If your powershell is using .Net 3.5, you will need to install Microsoft Chart Controls. .Net 4.0 and .Net 4.5 should be fine.

Community
  • 1
  • 1
Atilla Ozgur
  • 13,569
  • 3
  • 44
  • 65