한 원격 서버에서 PSSession 내부의 다른 폴더로 폴더를 복사하려고하는데 액세스가 거부 된 것처럼 오류가 발생합니다. 두 서버에 관리자 권한이 있습니다. PSSession없이 시도해도 작동합니다.PowerShell에서 원격 PSSession에서 다른 Windows 서버로 파일을 복사하는 방법
PS C:\Users\Automation\Documents\sample\SQL Final Scripts> Copy-Item -Path ".\SQL_queries.csv" -Destination "\\sql\c$\"
PS C:\Users\Automation\Documents\sample\SQL Final Scripts> Enter-PSSession -ComputerName sql -Credential "[email protected]"
[sql]: PS C:\Users\Automation\Documents> Copy-Item -Path ".\SQL_queries.csv" -Destination "\\jump\c$\"
Copy-Item : Access to the path '\\jump\c$\' is denied.
+ CategoryInfo : PermissionDenied: (C:\Users\Automa...SQL_queries.csv:FileInfo) [Copy-Item], Unauthorized
AccessException
+ FullyQualifiedErrorId : CopyFileInfoItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.CopyItemCommand
[sql]: PS C:\Users\Automation\Documents>
. SQL 서버'Enable-WSManCredSSP -Role Server'에서 이것을 실행하고 원격 세션에 들어가면 서버 B'Enable-WSManCred -Role Client -DelegateComputer *'에서 이것을 실행하십시오'Enter-PSSession -ComputerName sql -Authentication Credssp - Credential (Get-Credential) ' –
@BobLobLaw, 내 의견에 답 대신 답으로 게시하면 우수한 답변으로 받아 들여질 수 있습니다. – alroc