If I try and retrieve a CRL from a local file using a relative path, the Cmdlet throws an exception:
```
PS Scripts:\> Get-CRL .\Temp.crl
New-Object : Exception calling ".ctor" with "1" argument(s): "The system cannot find the file specified"
At Z:\Documents\WindowsPowerShell\Modules\PSPKI\Client\Get-CertificateRevocationList.ps1:23 char:4
+ New-Object Security.Cryptography.X509Certificates.X509CRL2 -ArgumentList $Pat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
```
The full path to the same file works fine:
```
PS Scripts:\> Get-CRL Z:\Documents\Scripts\Temp.crl
Version : 2
Type : Base CRL
IssuerDN : System.Security.Cryptography.X509Certificates.X500DistinguishedName
Issuer : CN=...
ThisUpdate : 20/11/2015 14:42:02
NextUpdate : 21/01/2016 03:02:02
SignatureAlgorithm : System.Security.Cryptography.Oid
Extensions : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid,
System.Security.Cryptography.Oid, System.Security.Cryptography.Oid...}
RevokedCertificates :
RawData : {48, 130, 2, 137...}
Handle : 483681408
```
UPDATE:
A relative path from the root of the local drive works:
```
PS Z:\> Get-CRL .\Documents\Scripts\Temp.crl
Version : 2
Type : Base CRL
IssuerDN : System.Security.Cryptography.X509Certificates.X500DistinguishedName
Issuer : CN=...
ThisUpdate : 20/11/2015 14:42:02
NextUpdate : 21/01/2016 03:02:02
SignatureAlgorithm : System.Security.Cryptography.Oid
Extensions : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid,
System.Security.Cryptography.Oid, System.Security.Cryptography.Oid...}
RevokedCertificates :
RawData : {48, 130, 2, 137...}
Handle : 483680112
```
But not from a sub-folder:
```
PS Z:\Documents> Get-CRL .\Scripts\Temp.crl
New-Object : Exception calling ".ctor" with "1" argument(s): "The system cannot find the file specified"
At Z:\Documents\WindowsPowerShell\Modules\PSPKI\Client\Get-CertificateRevocationList.ps1:23 char:4
+ New-Object Security.Cryptography.X509Certificates.X509CRL2 -ArgumentList $Pat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
```
Comments: This issue is not related to PSPKI, it is related to PowerShell and .NET .NET may have different working directory (or directory base) than PowerShell, this is why the command fails. ``` PowerShell [io.directory]::GetCurrentDirectory() ``` this command returns current directory for .NET assemblies.
```
PS Scripts:\> Get-CRL .\Temp.crl
New-Object : Exception calling ".ctor" with "1" argument(s): "The system cannot find the file specified"
At Z:\Documents\WindowsPowerShell\Modules\PSPKI\Client\Get-CertificateRevocationList.ps1:23 char:4
+ New-Object Security.Cryptography.X509Certificates.X509CRL2 -ArgumentList $Pat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
```
The full path to the same file works fine:
```
PS Scripts:\> Get-CRL Z:\Documents\Scripts\Temp.crl
Version : 2
Type : Base CRL
IssuerDN : System.Security.Cryptography.X509Certificates.X500DistinguishedName
Issuer : CN=...
ThisUpdate : 20/11/2015 14:42:02
NextUpdate : 21/01/2016 03:02:02
SignatureAlgorithm : System.Security.Cryptography.Oid
Extensions : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid,
System.Security.Cryptography.Oid, System.Security.Cryptography.Oid...}
RevokedCertificates :
RawData : {48, 130, 2, 137...}
Handle : 483681408
```
UPDATE:
A relative path from the root of the local drive works:
```
PS Z:\> Get-CRL .\Documents\Scripts\Temp.crl
Version : 2
Type : Base CRL
IssuerDN : System.Security.Cryptography.X509Certificates.X500DistinguishedName
Issuer : CN=...
ThisUpdate : 20/11/2015 14:42:02
NextUpdate : 21/01/2016 03:02:02
SignatureAlgorithm : System.Security.Cryptography.Oid
Extensions : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid,
System.Security.Cryptography.Oid, System.Security.Cryptography.Oid...}
RevokedCertificates :
RawData : {48, 130, 2, 137...}
Handle : 483680112
```
But not from a sub-folder:
```
PS Z:\Documents> Get-CRL .\Scripts\Temp.crl
New-Object : Exception calling ".ctor" with "1" argument(s): "The system cannot find the file specified"
At Z:\Documents\WindowsPowerShell\Modules\PSPKI\Client\Get-CertificateRevocationList.ps1:23 char:4
+ New-Object Security.Cryptography.X509Certificates.X509CRL2 -ArgumentList $Pat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
```
Comments: This issue is not related to PSPKI, it is related to PowerShell and .NET .NET may have different working directory (or directory base) than PowerShell, this is why the command fails. ``` PowerShell [io.directory]::GetCurrentDirectory() ``` this command returns current directory for .NET assemblies.