Solved

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

Posted on 2015-01-18
8
669 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
  • 3
  • 3
  • 2
8 Comments
 
LVL 79

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 7

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 79

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
 
LVL 7

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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 39

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 7

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 79

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 39

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

863 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

Need Help in Real-Time?

Connect with top rated Experts

29 Experts available now in Live!

Get 1:1 Help Now