Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy-FileToRemoteComputerSMB didn't throw error if test-path failed cause no failover to WinRM #110

Closed
luyaof opened this issue Mar 2, 2022 · 2 comments · Fixed by #113
Labels
bug Something isn't working

Comments

@luyaof
Copy link
Collaborator

luyaof commented Mar 2, 2022

Describe the bug
When copy file from remote machine via SMB, the Test-Path call will test if the path can be accessed or not.

        if (-NOT (Test-Path -Path $remotePath)) {
            "Unable to access {0}" -f $remotePath | Trace-Output -Level:Error
        }

Test-Path won't throw exception that can be handled by Copy-FileFromRemoteComputer to fallback to WinRM file copy. Logs failed to be copied finally.

Expected behavior
Test-Path to test each subpath, if all path can not be accessed. Throw exception. If any of the path can be accessed don't do that as could be folder level issue instead of machine level issue prevent SMB Copy

Another method might be use any cmdlet that can test SMB access and able to throw exception. For example: Get-Item

Screenshots
If applicable, add screenshots to help explain your problem.

Environment Details (please complete the following information):

  • Windows Server OS: Server 2019
  • SdnDiagnostics Version: 2.2202.215.82917

Additional context
Add any other context about the problem here.

@arudell
Copy link
Member

arudell commented Mar 9, 2022

@luyaof can you share more details on the actual exception that is being returned? Testing every sub-path on remote location may get resource intensive so it would be interesting to understand the use case that you are encountering.

@arudell arudell linked a pull request Mar 11, 2022 that will close this issue
7 tasks
@arudell
Copy link
Member

arudell commented Mar 11, 2022

@luyaof I was able to isolate the root cause of this issue because another background job had purged/deleted the underlying folder structure, resulting in the folder not existing anymore. In either scenario (SMB or WinRM) this would have failed. I updated the logging to indicate that it could not find path to be more clear if we hit it again, however this should be fixed with #113

@arudell arudell added the bug Something isn't working label Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants