Skip to content

Fixed issue with Resolve-Path breaking UNC keypaths.#385

Merged
jtarquino merged 3 commits intomicrosoft:masterfrom
Gavster4:master
Jul 11, 2022
Merged

Fixed issue with Resolve-Path breaking UNC keypaths.#385
jtarquino merged 3 commits intomicrosoft:masterfrom
Gavster4:master

Conversation

@Gavster4
Copy link
Contributor

@Gavster4 Gavster4 commented Jul 7, 2022

Fixes #384 .

Changes proposed in this pull request:

Changes Resolve-Path to examine the path as a Parent and Child instead of as a single unit to avoid damaging the proper UNC path.
How to test this code:
Restore-RSEncryptionKey -ReportServerInstance "Instance" -Password "Password" -KeyPath "\domain\share\folder\keyfile.snk"
(Testing outside the module requires functions in ShouldProcess.ps1 and ConnectionObjectRequests.ps1)

Has been tested on (remove any that don't apply):

PSVersion 5.1.17763.2931
Windows Server 2019 Datacenter
SQL Server 2016

Gavster4 added 2 commits July 6, 2022 15:11
Fixed issue with Resolve-Path breaking UNC keypaths.
…aking-UNC-keypaths

Update Restore-RsEncryptionKey.ps1
@Gavster4
Copy link
Contributor Author

Gavster4 commented Jul 7, 2022

@jtarquino I think the appveyor build failed out during the execution of the setup functions and didn't get to the point of testing the change I made. I'm unsure if there is anything I need to do to proceed.


$KeyPath = Resolve-Path $KeyPath

$KeyPath = Join-Path -Path (Resolve-Path -Path (Split-Path -Parent $KeyPath)).ProviderPath -ChildPath (Split-Path -Leaf $KeyPath)
Copy link
Member

@jtarquino jtarquino Jul 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of this consider using the ProviderPath available in the return object of Resolve-Path

you can see the full list of properties using the format-list , for example Resolve-Path "value" | format-list

and then you could change the code in this function with this line

$KeyPath = (Resolve-Path $KeyPath).ProviderPath #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtarquino Lets try this version. :) I appreciate the suggestion there. Looks like the build passed the point in the sql install check and the tests all ran this time as well. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with Resolve-Path in Restore-RSEncryptionKey

2 participants