Setting Up for Linux Desktops

Table Of Contents
if (Test-Path ".\plink.exe")
{
write-host -ForeGroundColor Yellow 'SSH client "plink.exe" found'
}
else
{
write-host -ForeGroundColor Red 'SSH client "plink.exe" not found, please download
from its official web site'
exit
}
}
if ($IsPSCP)
{
if (Test-Path ".\pscp.exe")
{
write-host -ForeGroundColor Yellow 'SSH client "pscp.exe" found'
}
else
{
write-host -ForeGroundColor Red 'SSH client "pscp.exe" not found, please download
from its official web site'
exit
}
}
}
function RunCmdViaSSH
{
Param($VM_Name, $User, $Password, $Cmd, $returnOutput = $false)
$VM= Get-VM $VM_Name
$IP = $VM.guest.IPAddress[0]
write-host "Run cmd on $VM_Name ($IP)"
if($returnOutput)
{
$command = "echo yes | .\plink.exe -ssh -l $user -pw $password $IP " + '"' + $cmd +'"'
$output = Invoke-Expression $command
return $output
}
else
{
echo yes | .\plink.exe -ssh -l $user -pw $password $IP "$cmd"
}
}
function UploadFileViaSSH
{
Param($VM_Name, $User, $Password, $LocalPath, $DestPath)
$VM= Get-VM $VM_Name
$IP = $VM.guest.IPAddress[0]
$command = "echo yes | .\pscp.exe -l $User -pw $Password $LocalPath $IP" + ":" + "$DestPath"
write-host "Upload file: $command"
Invoke-Expression $command
Setting Up Horizon 7 for Linux Desktops
84 VMware, Inc.