0

I run connect.ps1 from Ubuntu host and connect to Windows 10 remote client. The Connect.ps1 script invokes File.ps1 on remote Windows client and saves Output file, which has strange characters. If I run the script within the Windows 10 remote client, it outputs correct characters.

Output of running command remotely via Invoke-Command

\[32;1mName                                                                           DeviceID\[0m
\[32;1m----                                                                           --------\[0m
Intel(R) Management Engine Interface #1                                        PCI\\VEN_8086&DEV_A13A&SUBSYS_06BB1028&RE…
Motherboard resources                                                          ACPI\\PNP0C02\\0
Motherboard resources                                                          ACPI\\PNP0C02\\1
Motherboard resources                                                          ACPI\\PNP0C02\\2
Motherboard resources                                                          ACPI\\PNP0C02\\5

Output of running command locally on Windows 10 client

Name                                                          DeviceID

------------

Remote Audio                                                  SWD\\MMDEVAPI{3.0.0.00000001}.{6C26BA7D-F0B2-4225-B422-8168C5261E45}  
HID-compliant consumer control device                         HID\\VID_10D5&PID_55D0&MI_01&COL03\\8&29874174&0&0002

Connect.ps1

Invoke-Command $RemoteSession -FilePath File.ps1

File.ps1

Get-CimInstance -Class Win32_PNPEntity | Select-Object Name, DeviceID | Out-File -Force $OutFileTxt

I tried saving as CSV file using Export-Csv, but results are not displayed clearly.

Tried saving as CSV using Export-Csv without success. running Powershell command and saving output to variable, which is returned to host and saved as an output file, however this approach is slow when I want to list all windows files that takes about 14 minutes as compared to under 3 minutes if i save the output on the remote client.

tripleee
  • 175,061
  • 34
  • 275
  • 318

0 Answers0