Skip to content

Issue with Resolve-Path in Restore-RSEncryptionKey #384

@Gavster4

Description

@Gavster4

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
On using a UNC path for KeyPath, the result of Resolve-Path prepends the path with "Microsoft.PowerShell.Core\FileSystem::" which breaks the subsequent [System.IO.File]::ReadAllBytes($KeyPath).

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
Save the snk key file to a UNC path and pass that into the function as "\domain\share\folder\keyfile.snk".

Incorrect result:

Exception calling "ReadAllBytes" with "1" argument(s): "The given path's format is not supported."
At line:16 char:13
+             $keyBytes = [System.IO.File]::ReadAllBytes($KeyPath)
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : NotSupportedException

What is the expected behavior?
The result should pass in the UNC path starting at the "\" characters.

Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts?
Unsure if this was working prior. This was discovered on a new implementation of this module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions