Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2015-01-18
8
Medium Priority
?
1,241 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 84

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 1200 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 84

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 1200 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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 41

Assisted Solution

by:footech
footech earned 800 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 84

Assisted Solution

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

Accepted Solution

by:
footech earned 800 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
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 anti-spam), the admin…
Suggested Courses

916 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