Setting Up for Linux Desktops

Table Of Contents
}
#Read input CSV file
$csvData = Import-CSV $csvFile
$destFolder = "/home/$guestUser/"
#Handle VMs one by one
foreach ($line in $csvData)
{
"`n-----------------------------------------------------"
$VMName = $line.VMName
write-host -ForeGroundColor Yellow "VM: $VMName`n"
$cmd = "rm -rf VMware-viewagent-linux-*"
Write-Host "Run cmd '$cmd' in VM '$VMName' with user '$guestUser'"
RunCmdViaSSH -VM_Name $VMName -User $guestUser -Password $guestPassword -Cmd $cmd
#Upload installer tar ball to Linux VM
Write-Host "Upload File '$agentInstaller' to '$destFolder' of VM '$VMName' with user
'$guestUser'"
UploadFileViaSSH -VM_Name $VMName -User $guestUser -Password $guestPassword -LocalPath
$agentInstaller -DestPath $destFolder
#Check the uploaded installer md5sum
$cmd = "md5sum VMware-viewagent-linux-*"
Write-Host "Run cmd '$cmd' in VM '$VMName' with user '$guestUser'"
$output = RunCmdViaSSH -VM_Name $VMName -User $guestUser -Password $guestPassword -Cmd $cmd -
$returnOutput $true
if($output.Contains($installerMD5Hash))
{
Write-Host $VMName": Uploaded installer's MD5Sum matches the local installer's MD5Sum";
Write-Host $VMName": Extract the installer and do installation";
$cmd = "tar -xzf VMware-viewagent-linux-*.tar.gz"
Write-Host "Run cmd '$cmd' in VM '$VMName' with user '$guestUser'"
RunCmdViaSSH -VM_Name $VMName -User $guestUser -Password $guestPassword -Cmd $cmd
$cmd = "sudo setenforce 0";
Write-Host "Set the selinux to permissive mode: $cmd"
RunCmdViaSSH -VM_Name $VMName -User $guestUser -Password $guestPassword -Cmd $cmd
#Run the installation command.
$cmd = "cd VMware-viewagent-linux-* && sudo ./install_viewagent.sh -r yes -A yes -n
$VMName -b $brokerAddress -d $domainName -u $brokerAdminName -p $brokerAdminPassword -m
$installSmartcard"
if (!([string]::IsNullOrEmpty($kdc)))
{
$cmd = $cmd + " -k $kdc"
}
Write-Host "Run install cmd in VM '$VMName' with user '$guestUser'"
RunCmdViaSSH -VM_Name $VMName -User $guestUser -Password $guestPassword -Cmd $cmd
Write-Host -ForeGroundColor Yellow "Linux Agent installer will reboot the Linux VM after
Setting Up Horizon 7 for Linux Desktops
74 VMware, Inc.