Public/func_Remove-SSHServer.ps1
function Remove-SSHServer { [CmdletBinding()] param ( [Parameter(Position = 0, Mandatory = $true)][string]$Name ) [Collections.Generic.List[SSHServer]]$sshServers = Get-SSHServersFile $toedit = $sshServers | Where-Object Name -eq $Name if($null -eq $toedit) { Throw New-Object System.NullReferenceException("SSH Server not found") } $toedit | Out-Default $key = Read-Host -Prompt "Are you sure to delete this entry ?[Y/N]" if($key.ToUpperInvariant() -eq "Y") { $sshServers.Remove($toedit) | Out-Null Set-SSHServersFile -SSHServers $sshServers } else { Write-Host "Operation aborted" -ForegroundColor Yellow } } |