darkoperator / darkoperator/Posh-SSH
Extract linux version for all distribution
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 1.1k
- Forks
- 222
- PR merge metrics
- No merged PRs in 30d
Description
Hi guys,
i need to send these commands through any powershell ssh module in order to return the correct version of the operating system based on the distribution.
If I open putty and paste the code, it works without problems, if I use any module (posh-ssh or others) when I send this command, the output is an error.
Can anyone tell me why?
`$linuxhost = '192.168.10.207'
$LNXver = @'
/bin/bash<arch=$(uname -m)
kernel=$(uname -r)
if [ -n "$(command -v lsb_release)" ];
then distroname=$(lsb_release -s -d)
elif [ -f "/etc/os-release" ];
then distroname=$(grep PRETTY_NAME /etc/os-release | sed 's/PRETTY_NAME=//g' | tr -d '="')
elif [ -f "/etc/debian_version" ];
then distroname="Debian $(cat /etc/debian_version)"
elif [ -f "/etc/redhat-release" ];
then distroname=$(cat /etc/redhat-release)
else distroname="$(uname -s) $(uname -r)"
fi
echo "${distroname}"
'@
$LNXver2 = (Invoke-SSHCommand -ComputerName $linuxhost -Command $LNXver).result `
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the multiline /bin/bash command passed to Invoke-SSHCommand and compare its behavior with the same command in PuTTY. Capture the module's error output and determine whether the command can return the Linux distribution version through the SSH module.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, linux, powershell
- Domain
- cli, devops, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100