Closed bab5470 closed 9 years ago
What version of PowerShell and OS are you running this on? This error: Add-Type : (0) : Metadata file 'System.Core.dll' could not be found seems odd to me but am not quite sure why it is throwing that error.
> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
3 0 -1 -1
PS C:\Users\brad.baker> [Environment]::Is64BitProcess
True
The only thing I can think of that we have non-standard is that we have a powershell.exe.config with the following:
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
I think we needed to add this to solve some other issue on our system - although I don't specifically remember what the problem was.
That really shouldn't make a difference as this was tested on a Windows 2003 system supporting PowerShell V2 running .Net 2.0 and adding support for .Net 4.0 shouldn't have affected it. But any chance that you can test this on a different system?
It seems to work ok on another server i have so something in particular about this server - although that doesn't necessarily help me resolve the issue. Any other ideas?
Are you having any issues with other 3rd party modules on that system? Any chance that you are running in a constrained language mode via a System profile? This is something that I have not seen before and am not quite sure what could be causing the issue.
Are you having any issues with other 3rd party modules on that system? I'm not running any other third party modules but other scripts are working just fine.
Any chance that you are running in a constrained language mode via a System profile? Nope:
PS C:\Users\brad.baker> $Host.Runspace.LanguageMode
FullLanguage
I'm kind of at a loss on what to look at next besides reverting powershell.exe.config back its default configuration and testing to see what happens...or adding the config to another system for testing.
I've uninstalled and re-installed Microsoft.net 3.5 - that seems to have fixed things up. Sorry for bothering you!
No worries about it! Glad that you were able to get it resolved.
Getting the following error when trying to issue the import-module command for POSHRSJob command:
VERBOSE: Loading module from path 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PoshRSJob\PoshRSJob.psd1'. VERBOSE: Loading module from path 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PoshRSJob\PoshRSJob.psm1'. Add-Type : (0) : Metadata file 'System.Core.dll' could not be found (1) : using System; At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PoshRSJob\PoshRSJob.psm1:4 char:1
Add-Type : Cannot add type. There were compilation errors. At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PoshRSJob\PoshRSJob.psm1:4 char:1
VERBOSE: Importing function 'Get-RSJob'. VERBOSE: Importing function 'Receive-RSJob'. VERBOSE: Importing function 'Remove-RSJob'. VERBOSE: Importing function 'Start-RSJob'. VERBOSE: Importing function 'Stop-RSJob'. VERBOSE: Importing function 'Wait-RSJob'. VERBOSE: Importing alias 'gsj'. VERBOSE: Importing alias 'rmsj'. VERBOSE: Importing alias 'rsj'. VERBOSE: Importing alias 'spsj'. VERBOSE: Importing alias 'ssj'. VERBOSE: Importing alias 'wsj'.
Any idea how I can work around this issue?
Thanks Brad