HostConnectorModule.psm1

using module Microsoft.AVS.Management
# Todo: delete CreateSession

Function CreateSession {
    Write-Host "Create Session was called"
    $hostName="192.168.132.1"
    $userName="root"
    $password="Zertodata1!"

    $secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
    $credentials = New-Object System.Management.Automation.PSCredential($userName, $secpasswd)

    $SSH = New-SSHSession -ComputerName $hostName -Credential $credentials #-AcceptKey 1
    return $SSH
} 

Function Test{
    Write-Host "Test New Module !!!! "
}

Function GetHostTempFolderInfo {
    $SSH=CreateSession
    $Command="vdf"
    $SSHOut = $(Invoke-SSHCommand -SSHSession $SSH -Command $Command)
    return $SSHOut.ExitStatus, $SSHOut.Output
}

Function EnsurePrivateKeyConnectivity {
    $SSH=CreateSession
    $Command="echo testing123"
    $SSHOut=(Invoke-SSHCommand -SSHSession $SSH -Command $Command).ExitStatus 
    return $SSHOut.ExitStatus, $SSHOut.Output
}

Function GetEsxiVersionWithSsh {
    $SSH=CreateSession
    $Command="vmware -l"
    $SSHOut = $(Invoke-SSHCommand -SSHSession $SSH -Command $Command).ExitStatus
    return $SSHOut.ExitStatus, $SSHOut.Output
}