Solved

Unable to find type [ordered]: make sure that the assembly containing this type is loaded.

Posted on 2015-01-18
8
943 Views
Last Modified: 2015-01-21
Folks,

I'm trying to run a Powershell script which used the ordered list, but somehow it failed on my Windows 7 laptop with the below error message:

Unable to find type [ordered]: make sure that the assembly containing this type is loaded.


I'm using PowerGUI to execute all powershell and the below is the output of the versions:

Code:
gci 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' | sort pschildname -des | foreach-object {$_.name; $_.GetValue("Version");}

Open in new window


Result:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5
3.5.30729.5420
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0
3.0.30729.5420
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727
2.0.50727.5420
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\CDF

PS C:\Users\Administrator\Documents> $PSVersionTable

Open in new window

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

PS C:\Users\Administrator\Documents> Get-PowerCLIVersion

Open in new window

PowerCLI Version
----------------
VMware vSphere PowerCLI 5.8 Release 1 build 2057893
---------------
Snapin Versions
---------------
VMWare AutoDeploy PowerCLI Component 5.5 build 1983942
VMWare ImageBuilder PowerCLI Component 5.5 build 1983942
VMware License PowerCLI Component 5.5 build 1265954
VMware Storage PowerCLI Component 5.8 build 2057894
VMware VDS PowerCLI Component 5.8 build 2031581
VMware vSphere PowerCLI Component 5.8 build 2031581

I'm sure that I have installed the .NET Framework 4.0 (Windows6.1-KB2819745-x64-MultiPkg.msu) but somehow the code is still stuck with no chance to get it running for the first time.

Any help would be greatly appreciated.

Thanks.
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 82

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 300 total points
ID: 40556904
You are running an ancient version of powershell.  You should at the minimum update to powershell 3.0 or even better 4.0 (Install Install Powershell 4.0 in Windows 7
0
 
LVL 8

Author Comment

by:Senior IT System Engineer
ID: 40556929
Yeah, I know:


Name                           Value
  ----                                -----
PSVersion                      2.0

But I cannot install the powershell 3.0 because it would break my Exchange Server management console in my Windows 7.

I have already installed the Windows6.1-KB2819745-x64-MultiPkg.msu, but somehow it is still showing as PS version 2.0

what can I do to run it under PS 4.0 ?
0
 
LVL 82

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 300 total points
ID: 40556952
But I cannot install the powershell 3.0 because it would break my Exchange Server management console in my Windows 7. I find that hard to believe. Which version of Exchange Server?
0
What, When and Where - Security Threats from Q1

Join Corey Nachreiner, CTO, and Marc Laliberte, Information Security Threat Analyst, on July 26th as they explore their key findings from the first quarter of 2017.

 
LVL 8

Author Comment

by:Senior IT System Engineer
ID: 40556958
Exchange Server 2010, for all types of server deployment including workstation with Exchange Management Console.

So I'm skipping .NET Fx 3.0 but somehow I still don;t understand as to why I cannot use or install .NET Fx 4.0 ?

I have rebooted my laptop couple of times already but it is still showing as PS 2.0 not yet 4.0 ?
0
 
LVL 40

Assisted Solution

by:footech
footech earned 200 total points
ID: 40556988
The is a difference between .Net version and Windows Management Framework (WMF) version.  You need to install the newer WMF.  As I recall, Exchange 2010 wasn't compatible with PS 3.0 until something like service pack 3 update 10.
0
 
LVL 8

Author Comment

by:Senior IT System Engineer
ID: 40556997
Ok, after installing the .NET Fx 4.5.2 NDP452-KB2901907-x86-x64-AllOS-ENU.exe, now my Exchange management console broke with the following error:

Cannot load Windows PowerShell snap-in Microsoft.Exchange.Management.PowerShell.E2010 because of the following error: The type initializer for 'Microsoft.Exchange.Data.Directory.Globals' threw an exception.

as per this website: http://www.powershellserver.com/powershell-server-cannot-load-windows-powershell-snap-in-microsoft-exchange-management-powershell-e2010/

it says I have to uninstall the .NET Fx
0
 
LVL 82

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 300 total points
ID: 40557113
The solution is to remove .net 4.5.x and repair/reinstall .net 4.0
0
 
LVL 40

Accepted Solution

by:
footech earned 200 total points
ID: 40557157
OK, so you have to have .NET 4.5 installed to install WMF/PS 4.0 (otherwise it silently fails), but you have to have SP3 Update 5 (obviously my reference to update 10 was incorrect) or later for Exchange 2010 installed (not sure if you can update Exchange afterward and have it work).
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
The viewer will learn how to count occurrences of each item in an array.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question