peewpw/Invoke-WCMDump

linq error - win7

richrumble opened this issue · 3 comments

Fully Patched Win7 install -

PS C:\temp> $psversiontable
Name Value


CLRVersion 2.0.50727.8762
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1

PS C:\temp> Invoke-WCMDump
Add-Type : c:\Users\user\AppData\Local\Temp\3cojicol.0.cs(6) : The type or namespace name 'Linq' does not exist in the namespace 'System' (are
you missing an assembly reference?)
c:\Users\user\AppData\Local\Temp\3cojicol.0.cs(5) : using System.Collections.Generic;
c:\Users\user\AppData\Local\Temp\3cojicol.0.cs(6) : >>> using System.Linq;
c:\Users\user\AppData\Local\Temp\3cojicol.0.cs(7) : using System.Runtime.InteropServices;
At C:\temp\creds.ps1:251 char:20

  • $add = Add-Type <<<<  -TypeDefinition $source -Language CSharp -PassThru
    
    • CategoryInfo : InvalidData: (c:\Users\user...bly reference?):CompilerError) [Add-Type], Exception
    • FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand

Add-Type : Cannot add type. There were compilation errors.
At C:\temp\creds.ps1:251 char:20

  • $add = Add-Type <<<<  -TypeDefinition $source -Language CSharp -PassThru
    
    • CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationException
    • FullyQualifiedErrorId : COMPILER_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand

Unable to find type [Credential]: make sure that the assembly containing this type is loaded.
At C:\temp\creds.ps1:252 char:28

  • $loadAll = [Credential] <<<< ::LoadAll()
    
    • CategoryInfo : InvalidOperation: (Credential:String) [], RuntimeException
    • FullyQualifiedErrorId : TypeNotFound

Same error here... I have got .NET framework 3.5.1 and still don't see System.Linq.dll file in the folder.

I rewrote the bits that were using Linq; should be all good now!

Confirmed to be working after your change. Thank you, @peewpw!