Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Copy-Item -ToSession from WIndows to Linux corrupts the transferred file #126

Open
iga1976 opened this issue Sep 27, 2018 · 3 comments
Open

Comments

@iga1976
Copy link

iga1976 commented Sep 27, 2018

Having the following environment:

Linux OS is SLES 12-SP2 x86_64
tony@linux-31cz:~> /opt/omi/bin/omiserver -v
/opt/omi/bin/omiserver: OMI-1.5.0-0 - Mon Jul 23 09:07:48 PDT 2018
tony@linux-31cz:~> rpm -qa | grep psrp
omi-psrp-server-1.4.2-2.x86_64
tony@linux-31cz:~> rpm -qa | grep powershell
powershell-6.1.0-1.rhel.7.x86_64

On Windows 2016 with the default Powershell

PS C:\Users\Administrator.ADIDAS> $host


Name             : ConsoleHost
Version          : 5.1.14393.2155
InstanceId       : 4f6ce772-9aa7-46a4-9b2f-116d54cc1117
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

On Windows i create a remote powershell session to Linux SLES, and the Remote copy from Windows to Linux fails:

Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\Users\Administrator.ADIDAS> $SecurePass = ConvertTo-SecureString -String "root-password" -AsPlainText -Force
PS C:\Users\Administrator.ADIDAS> $Cred = New-Object System.Management.Automation.PSCredential "root" , $SecurePass
PS C:\Users\Administrator.ADIDAS> $Opt = New-PSSessionOption -SkipCACheck -SkipRevocationCheck -SkipCNCheck
PS C:\Users\Administrator.ADIDAS> $Session = New-PsSession -Credential $Cred -ComputerName 11.0.0.21 -Port 5986 -Authentication Basic -SessionOption $Opt -UseSSL
PS C:\Users\Administrator.ADIDAS> Copy-Item -Path 'c:\package-8.1.7-0.x86_64.tar.gz' -Destination '/tmp/' -ToSession $Session -UseTransaction
>>
The provider does not support transactions. Perform the operation again without the -UseTransaction parameter.
At line:1 char:1
+ Copy-Item -Path 'c:\package-8.1.7-0.x86_64.tar.gz ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotImplemented: (:) [], PSNotSupportedException
    + FullyQualifiedErrorId : NotSupported

PS C:\Users\Administrator.ADIDAS> Copy-Item -Path 'c:\package-8.1.7-0.x86_64.tar.gz' -Destination '/tmp/' -ToSession $Session
PS C:\Users\Administrator.ADIDAS> Enter-PSSession $Session
[11.0.0.21]: PS /root> iex 'tar -tzf /tmp/package-8.1.7-0.x86_64.tar.gz'
opt/app/
opt/app/DE_DE/
opt/app/DE_DE/tdps.cat
opt/app/EN_US/
opt/app/EN_US/tdps.cat
opt/app/ES_ES/
opt/app/ES_ES/tdps.cat
opt/app/FR_FR/
opt/app/FR_FR/tdps.cat
opt/app/IT_IT/
opt/app/IT_IT/tdps.cat
opt/app/JA_JP/
opt/app/JA_JP/tdps.cat
opt/app/KO_KR/
opt/app/KO_KR/tdps.cat
opt/app/PT_BR/
opt/app/PT_BR/tdps.cat
opt/app/ZH_CN/
opt/app/ZH_CN/tdps.cat
opt/app/ZH_TW/
opt/app/ZH_TW/tdps.cat
opt/app/mssqlsmoapp_root/
opt/app/mssqlsmoapp_root/mssqlsmoapp.dll
opt/app/mssqlsmoapp_root/mssqlsmoapp.pdb
opt/app/mssqlsmoapp_root/Microsoft.Data.Tools.Sql.BatchParser.dll
opt/app/mssqlsmoapp_root/Microsoft.SqlServer.ConnectionInfo.dll
opt/app/mssqlsmoapp_root/Microsoft.SqlServer.Management.Dmf.dll
opt/app/mssqlsmoapp_root/Microsoft.SqlServer.Management.Sdk.Sfc.dll
opt/app/mssqlsmoapp_root/Microsoft.SqlServer.Smo.dll
opt/app/mssqlsmoapp_root/Microsoft.SqlServer.SmoExtended.dll
opt/app/mssqlsmoapp_root/Microsoft.SqlServer.SqlEnum.dll
opt/app/mssqlsmoapp_root/NetCoreGlobalization.dll
opt/app/mssqlsmoapp_root/Newtonsoft.Json.dll
opt/app/mssqlsmoapp_root/Microsoft.CSharp.dll
opt/app/mssqlsmoapp_root/Microsoft.VisualBasic.dll
/bin/tar: Skipping to next header
/bin/tar: A lone zero block at 20330
/bin/tar: Exiting with failure status due to previous errors
[11.0.0.21]: PS /root>

@iga1976
Copy link
Author

iga1976 commented Sep 27, 2018

I also tried:

PS C:\Users\Administrator.ADIDAS> $Session = New-PsSession -Credential $Cred -ComputerName 11.0.0.21 -Port 5986 -Authentication Basic -SessionOption $Opt -UseSSL
New-PsSession : [11.0.0.21] Connecting to remote server 11.0.0.21 failed with the following error message : only utf 8
is supported For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:12
+ $Session = New-PsSession -Credential $Cred -ComputerName 11.0.0.21 -P ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
   gTransportException
    + FullyQualifiedErrorId : -2144108491,PSSessionOpenFailed
PS C:\Users\Administrator.ADIDAS>

@iga1976
Copy link
Author

iga1976 commented Sep 27, 2018

I am attaching the screens with the diffs. I noticed they could vary.
compare-1
compare-2
compare-3

@iga1976
Copy link
Author

iga1976 commented Sep 27, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant