Solved

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

Posted on 2015-01-18
8
614 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 78

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 300 total points
Comment Utility
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
Comment Utility
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 78

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 300 total points
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 39

Assisted Solution

by:footech
footech earned 200 total points
Comment Utility
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
Comment Utility
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 78

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 300 total points
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Set OWA language and time zone in Exchange for individuals, all users or per database.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

763 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

12 Experts available now in Live!

Get 1:1 Help Now