HI All!
I'm in the process of learning PowerShell and had a question. I'm trying to find a certificate from a specific issuer in the local computer personal store. Anyone have any ideas or have a previously written script for something like this written in PowerShell 2.0?
S
Find certificate using PowerShell 2.0
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.
- Nemesis808
- Posts: 6
- Last visit: Thu Dec 14, 2023 2:46 pm
Re: Find certificate using PowerShell 2.0
jvierra wrote:Get-Content cert:CurrentUser\My | select issuer,subject
When I run the above I get the following error message
Get-Content : Cannot use interface. The IContentCmdletProvider interface is not implemented by this provider.
At C:\Users\XXXXX\Documents\SAPIEN\PowerShell Studio\Files\Detect_Certificate.ps1:13 char:1
+ Get-Content cert:CurrentUser\My | select issuer, corp-XXXXXXX-CA
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (:) [Get-Content], PSNotSupportedException
+ FullyQualifiedErrorId : NotSupported,Microsoft.PowerShell.Commands.GetContentCommand
- Nemesis808
- Posts: 6
- Last visit: Thu Dec 14, 2023 2:46 pm
Re: Find certificate using PowerShell 2.0
jvierra wrote:Get-Content cert:CurrentUser\My | select issuer,subject
With Powershell 2.0 shouldn't I be using "System.Security.Cryptography.X509Certificates" ?
Re: Find certificate using PowerShell 2.0
If your 2.0 does not have the cert provider??? Yes. Try the example first. The CERT provider is available on all current versions of PowerShell. PS 2 is current on WS2008R2.
- Nemesis808
- Posts: 6
- Last visit: Thu Dec 14, 2023 2:46 pm
Re: Find certificate using PowerShell 2.0
jvierra wrote:If your 2.0 does not have the cert provider??? Yes. Try the example first. The CERT provider is available on all current versions of PowerShell. PS 2 is current on WS2008R2.
All of our systems are running PS 2.0... what should I do?
- Nemesis808
- Posts: 6
- Last visit: Thu Dec 14, 2023 2:46 pm
Re: Find certificate using PowerShell 2.0
jvierra wrote:Try the code I posted.
When i do i get this.....
Get-Content : Cannot use interface. The IContentCmdletProvider interface is not implemented by this provider.
At line:1 char:1
+ Get-Content cert:CurrentUser\My | select issuer,subject
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (:) [Get-Content], PSNotSupportedException
+ FullyQualifiedErrorId : NotSupported,Microsoft.PowerShell.Commands.GetContentCommand
Am i missing something???
- Nemesis808
- Posts: 6
- Last visit: Thu Dec 14, 2023 2:46 pm
Re: Find certificate using PowerShell 2.0
It's working! Thanks jvierrajvierra wrote:Get-ChildItem cert:
Sorry. I typoed. It should read:
Get-ChildItem cert:\CurrentUser\My | select issuer,subject