darkoperator / darkoperator/Posh-SSH

Import a remote csv values

Open
#262 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1.1k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

I want to import the content of a csv inside a variable, i tryed with this code but the result include:
[01;32mroot@NAS:~# cat /root/info.csv Firmware|Host Name|Ip
4.15|pc-lnx|192.168.0.110

I want to import only the cat result:
Firmware|Host Name|Ip
4.15|pc-lnx|192.168.0.110

is it possible ?

$Session = New-SSHSession -ComputerName "192.168.10.110" -Port 22 -Credential root -AcceptKey
$SessionId=Get-SSHSession
$SessionId=$SessionId.SessionId
$SSHStream = New-SSHShellStream -Index $SessionId
$cmd2 = @'
cat /root/info.csv 
'@

$output = Invoke-SSHStreamShellCommand -ShellStream $SSHStream -Command $cmd2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with New-SSHShellStream and Invoke-SSHStreamShellCommand in the example, then inspect how the returned shell output is assembled. Reproduce the command against /root/info.csv and determine how the variable can contain only the CSV lines, without the prompt or terminal escape sequences.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.