Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install SSH #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions EnableSSHRemoting.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ function Enable-SSHRemoting
[switch] $Force
)

# Detect platform
$platformInfo = [PlatformInfo]::new()
DetectPlatform $platformInfo
Write-Verbose "Platform information"
Write-Verbose "$($platformInfo | Out-String)"

# Non-Windows platforms must run this cmdlet as 'root'
if (!$platformInfo.isWindows)
{
Expand Down Expand Up @@ -353,23 +359,24 @@ function Enable-SSHRemoting
}
}

# Detect platform
$platformInfo = [PlatformInfo]::new()
DetectPlatform $platformInfo
Write-Verbose "Platform information"
Write-Verbose "$($platformInfo | Out-String)"

# Detect SSH client installation
if (! (Get-Command -Name ssh -ErrorAction SilentlyContinue))
{
Write-Warning "SSH client is not installed or not discoverable on this machine. SSH client must be installed before PowerShell SSH based remoting can be enabled."
{
$SSHCFound = $false
$SSHCFound = (Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0).Online
if (! $SSHCFound) {
Write-Warning "SSH client is not installed or not discoverable on this machine. SSH client must be installed before PowerShell SSH based remoting can be enabled."
}
}

# Detect SSHD server installation
$SSHDFound = $false
if ($platformInfo.IsWindows)
{
$SSHDFound = $null -ne (Get-Service -Name sshd -ErrorAction SilentlyContinue)
If (! $SSHDFound) {
$SSHDFound = (Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0).Online
}
}
elseif ($platformInfo.IsLinux)
{
Expand Down