Hello
can someone please help me with the following (perhaps I am missing a DLL)
One Windows 2012 R2 I need to load Security.Cryptography.X509Certificates.RSACertificateExtensions part as part of a larger PowerShell script
I get the standard message
Add-Type -AssemblyName Security.Cryptography.X509Certificates.RSACertificateExtensions
Add-Type : Cannot add type. The assembly 'Security.Cryptography.X509Certificates.RSACertificateExtensions' could not be found.
At line:1 char:1
+ Add-Type -AssemblyName Security.Cryptography.X509Certificates.RSACert ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Security.Crypto...icateExtensions:String) [Add-Type], Exception
+ FullyQualifiedErrorId : ASSEMBLY_NOT_FOUND,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : Cannot add type. One or more required assemblies are missing.
At line:1 char:1
+ Add-Type -AssemblyName Security.Cryptography.X509Certificates.RSACert ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationException
+ FullyQualifiedErrorId : ASSEMBLY_LOAD_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand
I assume I am missing a DLL
on my Windows 10 PC I can do the following OK
[Security.Cryptography.X509Certificates.RSACertificateExtensions] | gm
if I try this on my Windows 2012 R2 Server I get the error
PS C:\> [Security.Cryptography.X509Certificates.RSACertificateExtensions] | gm
Unable to find type [Security.Cryptography.X509Certificates.RSACertificateExtensions]. Make sure that the assembly that contains this type is loaded.
At line:1 char:2
+ [Security.Cryptography.X509Certificates.RSACertificateExtensions] | gm
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Security.Crypto...icateExtensions:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Please advise as I need to use this namespace and its methods when running my script on a Windows 2012 R2 Server
Thanks
Ernest
Cannot load Security.Cryptography.X509Certificates.RSACertificateExtensions
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Cannot load Security.Cryptography.X509Certificates.RSACertificateExtensions
You do not need to load the assembly. this is not an assembly, it is a type. Just reference it:
[Security.Cryptography.X509Certificates.RSACertificateExtensions][/b}
It may be that you are missing Net 4.6 which is an optional install on 2012r2
See: https://msdn.microsoft.com/en-us/librar ... .110).aspx
[Security.Cryptography.X509Certificates.RSACertificateExtensions][/b}
It may be that you are missing Net 4.6 which is an optional install on 2012r2
See: https://msdn.microsoft.com/en-us/librar ... .110).aspx