Archives for November 2011


The Best VMware View PowerShell Variable – Inform the Users

Running a lot of persistent desktops can have it’s it challenges. While persistent desktops are easier on the infrastructure; like DNS, DHCP, and storage IO they’re a real pain to manage. Since windows is windows, you do need to reboot your windows virtual desktop or else it will eventually get slow by some memory leaking program. It’s kind of funny that all things that a user would put up with a physical desktop, but when it comes to VDI they except the world(this can be good). I think the high exception is because you have given them something that is new and that they’re unsure of.

To help move your users move along their VDI journey, you can tell them how long their virtual desktop has been running my emailing them. Hopefully by letting them know, maybe you can prevent a help desk ticket.

The below code has to run on the View Connection Broker. There might be a better way to get the user’s email address but I don’t know it. If you do please do tell!

Import-Module ActiveDirectory
#need to grab AD information later

$listOfvms = Get-DesktopVM -vc_id (Get-ViewVC -serverName "vCenter").vc_id
#Grab all the desktops that your connection brokers are using,this will pull replica's as well
foreach ( $vms in $listOfvms){

if ($vms.isInPool -eq "true")
#if the desktop is in a pool see how long it's been running
$wmi = Get-WmiObject -ComputerName $vms.Name -Query "SELECT LastBootUpTime FROM Win32_OperatingSystem"
$now = Get-Date
$boottime = $wmi.ConvertToDateTime($wmi.LastBootUpTime)
$uptime = $now - $boottime
$d =$uptime.days
$user = Get-ADUser $vms.user_sid #Get AD user info so we can build the email address
$userSID = $vms.user_sid #Best PowerShell Variable b\c it means you know which desktops have been assigned and are active by users

#If the desktop has been running for 7 days and desktop is being used by a user, send an email
if ($d -gt "7"-and $userSID -gt 1){
Write-Host $userSID
$mail = New-Object System.Net.Mail.MailMessage
$user = Get-ADUser $vms.user_sid
$mail = New-Object System.Net.Mail.MailMessage
$emailTo = $user.GivenName + "." + $user.SurName + ""
$mail.From = ""
Write-Host $mail.From
$mail.Subject = "Your VDI Desktop has been running for " + $d + " days"
$mail.Body = "Your " + $ + " desktop has been running for " + $d + " days. If performance is slow please take the time restart your desktop. To restart your virtual machine please select the option from the Start menu. "
Write-Host $emailTo
$smtp = New-Object System.Net.Mail.SmtpClient("emailserver")
$emailTo = ""

$userSID = ""


#VDI Tip 52: Rat A Dat Dat, better Thin Dat

For a long time I thought DAT files where bad. They were normally very big and I considered them an extra file. I have now realized the error of my ways. DAT files are great because the help control your anti-virus by scanning a small exe and then excluding the DAT file. Exclude outgoing DAT’s on your server hosting your streaming apps and exclude DAT files incoming on your VDI desktops. Remember to remove any extra files, like user state files, extra language options and temp directories with install files.


VMware View 5 and MS Lync

While it will be never be supported by Microsoft(MS) it can be done. What is that you ask? MS Lync will run on VMware View and will work good if you can stay from running any USB devices. VMware offers Unified Communications (UC) API that reduces load on servers, reduces bandwidth and allows for QoS since the VoIP and PCoIP traffic can be split up. The API should allow you to squeeze more VM’s out of your hosts as well, though I am in favour of having head room for the bursting nature of VDI.

To get MS Lync to run on View 5 follow the basic guidelines that have been listed in VMware View Performance Best Practice Guidelines.
• Turn Build to Losses off
• Drop the Frame Rate to 8 – 12(I prefer 12)
• Limit the sounds quality to 100 – 150 Kbps (Note this does not affect USB devices)

The above can all be changed from the PCOIP.ADM object thru Group Policy. The Frame Rate setting is inside of the Image quality setting.

The next thing to do is go off to and download the Teradici virtual audio driver. It’s a basic install. If your upgrading from View 4.6 , the audio driver will get set back to the default windows audio device.

Once that is done all you need to do is buy a headset that is not USB. I found it hard finding a non-USB headset but stumbled upon Cyber Acoustics AC-201 Stereo Headset/microphone.

With the reduction of CPU processing for PCoIP in View 5 I think it’s ok to offer MS Lync via View to your end users.

Good Luck out there.