Fixed issue with Resolve-Path breaking UNC keypaths.#385
Fixed issue with Resolve-Path breaking UNC keypaths.#385jtarquino merged 3 commits intomicrosoft:masterfrom
Conversation
Fixed issue with Resolve-Path breaking UNC keypaths.
…aking-UNC-keypaths Update Restore-RsEncryptionKey.ps1
|
@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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
@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!
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