microsoft/SdnDiagnostics

Copy using SMB files as -Credential is not passed

arudell opened this issue · 0 comments

Describe the bug
Copy-FileToRemoteComputer and Copy-FileFromRemoteComputer currently do not pass the $Credential variable to the SMB file copy method. In scenarios where -Credential is required, we hit an "Access Denied" and fallback to WinRM.

To improve the experience, we need to add support for -Credential when copying files. Copy-Item does not natively support -Credential so we will need to ensure we leverage New-PSDrive to fill this gap. Additional logic needed to detect if already exists.

To Reproduce
Steps to reproduce the behavior:

  1. Enter into remote session and then attempt to Install-SdnDiagnostics to fabric nodes, while passing -Credential.
  2. Observe the SMB copy operation fails due to Access Denied and fallback to WinRM proceeds to copy the file.

Expected behavior
We should support credential when performing SMB file copy operation.