Public/func_Set-SSHServer.ps1
function Set-SSHServer { [CmdletBinding()] param ( [Parameter(Position = 0, Mandatory = $true)][string]$Name, [Parameter(Position = 1, Mandatory = $true)][string]$IP, [Parameter(Position = 2, Mandatory = $false)][string[]]$Tags ) [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") } $sshServers.Remove($toedit) | Out-Null $toedit.IP = $IP if($null -ne $Tags) { $toedit.Tags = $Tags } $sshServers.Add($toedit) Set-SSHServersFile -SSHServers $sshServers } |