Saturday, October 26, 2013

Starting up the Lync Test Drive VM Farm

I wrote recently about the Lync 2013 Test Drive set of Virtual Machines. These are pretty neat, although they are a large download, and expand to a very large size. But worth it for the ease of use. In testing it, I found it uses a lot of RAM, so if you want to run all of the VMs at once, I found I needed 32 GB of RAM. But even then, starting up 7 VMs even on my Precision 7400 box takes a lot of time.

If you just start all the VMs at once, they all grind very slowly to life. It seems to take 15-20 minutes to get it all started – I usually start the VMs and go off and make coffee! A big downside to this approach, and one I regularly confront in the classroom, is that Exchange, Lync and the Certificate Services sometimes do not start or start fully. It tends to be the Lync and Exchange services that fail to start. And while the AD Certificate Services starts up OK, it can end up unable to issue a certificate if requested by Lync’s installation package.

Now this is NOT new. I’ve been seeing it in my classrooms since OCS 2007 days. There are a couple of simple solutions to this problem (and probably more):

First, just start VMs up more slowly – waiting a few minutes between starting each one. If you wait until you can login to the DC, for example, before starting anything else, issues like authentication from remote machines (e.g. the remote machines wants to take advantage of the DC before the DC’s netlogon service is fully up and able to  accommodate) just go away. Sufficient staggering of the startup of each VM eliminates the risks of services not starting.

Second, you could create a simple start-up script for each machine that slept for, say 10-15 minutes, then started any un-started  services. Once you create the script you could then apply it using local group policy. That way when the three systems start, they wait (till the server calms down a little after boot) and just start any services that do not run. This is more effort than the first.  I’ll post that script in another blog post.

So here’s my script that starts up the VM farm:

# Script to start the Lync Test-Drive VMs
Write-Host " Starting Lync Test Drive Farm on $(hostname) at: $(Get-date)"
Ipmo Hyper-V

# First start up Dc, and wait for 90 seconds

Write-Host "Starting DC1 at $(get-date)"
Start-VM -name '2013-DC'
Start-Sleep 90

# Now startup Lync FE and wait 7 minutes then start the mgt service
# and wait 4 more minutes
Write-Host "Starting Lync-FE at $(get-date)"
Start-VM -Name '2013-Lync-FE'
Start-sleep 300

Write-Host "Starting Lync-Mgt at $(get-date)"
Start-VM -Name '2013-Lync-MGT'
Start-sleep 240

# Startup Exchange and wait 5 minutes
Write-Host "Starting Exchange at $(get-date)"
Start-VM -Name '2013-Exchange'
Start-sleep 300

# Startup TS then SharePoint and wait 2 minutes
Write-Host "Starting ts at $(get-date)"
Start-VM -Name '2013-TS'
Start-sleep 120

Write-Host "Starting Sharepoint at $(get-date)"
Start-VM -Name '2013-SharePoint'
Start-sleep 120

# Lastly Startup WAC
Write-Host "Starting Wac at $(get-date)"
Start-VM -Name '2013-WAC'

# All done
"-" * 50

Get-VM -Name 2013*

# and where are we?
$Username   = "Contoso\administrator"
$Password   = 'Jasmine1'
$PasswordSS = ConvertTo-SecureString  -String $Password -AsPlainText -Force
$CredC      = New-Object -Typename System.Management.Automation.PSCredential `
             -Argumentlist $Username,$PasswordSS

Get-WMIObject -Class Win32_Service -computer 2013-Lync-FE -Credential $CredC |
    where {($_.startmode -EQ 'Auto') -AND ($_.Name -Match "rtc")} | ft -AutoSize

Get-WMIObject -Class Win32_Service -computer 2013-Exchange -Credential $CredC |
    where {$_.startmode -EQ 'Auto'  -And $_.Name -match 'MSExchange'} | ft -Auto


The results of running this script, which takes around 20 minutes, look like this:

PSH [C:\foo]: C:\builds\Dropbox\Lync Test Drive scripts\Start-TestLab.ps1
Starting Lync Test Drive Farm on Cookham12 at: 10/25/2013 20:51:32
Starting DC1 at 10/25/2013 20:51:32
Starting Lync-FE at 10/25/2013 20:53:03
Starting Lync-Mgt at 10/25/2013 20:58:05
Starting Exchange at 10/25/2013 21:02:06
Starting ts at 10/25/2013 21:07:08
Starting Sharepoint at 10/25/2013 21:09:10
Starting Wac at 10/25/2013 21:11:13

Name            State   CPUUsage(%) MemoryAssigned(M) Uptime   Status           
----            -----   ----------- ----------------- ------   ------           
2013-WAC        Running 1           1024              00:00:00 Operating normally
2013-TS         Running 1           2048              00:04:10 Operating normally
2013-SHAREPOINT Running 0           2048              00:02:07 Operating normally
2013-LYNC-MGT   Running 0           564               00:13:14 Operating normally
2013-LYNC-FE    Running 3           4096              00:18:15 Operating normally
2013-EXCHANGE   Running 1           4096              00:09:12 Operating normally
2013-DC         Running 0           1174              00:19:47 Operating normally

ExitCode Name           ProcessId StartMode State   Status
-------- ----           --------- --------- -----   ------
       0 MSSQL$RTC           1648 Auto      Running OK   
       0 MSSQL$RTCLOCAL      1760 Auto      Running OK   
       0 RTCASMCU            2728 Auto      Running OK   
       0 RTCATS               692 Auto      Running OK   
       0 RTCAVMCU            1200 Auto      Running OK   
       0 RTCCAA              4028 Auto      Running OK   
       0 RTCCAS              4252 Auto      Running OK   
       0 RTCCHAT             4504 Auto      Running OK   
       0 RTCCHATCOMPL        4556 Auto      Running OK   
       0 RTCCLSAGT           4612 Auto      Running OK   
       0 RTCCPS              4828 Auto      Running OK   
       0 RTCDATAMCU          4184 Auto      Running OK   
       0 RTCIMMCU            5288 Auto      Running OK   
       0 RTCMEDSRV           5784 Auto      Running OK   
       0 RTCPDPAUTH          6160 Auto      Running OK   
       0 RTCPDPCORE          7384 Auto      Running OK   
       0 RTCRGS              6424 Auto      Running OK   
       0 RtcSrv              6756 Auto      Running OK   
       0 RTCXMPPTGW          6616 Auto      Running OK   

ExitCode Name                         ProcessId StartMode State   Status
-------- ----                         --------- --------- -----   ------
       0 MSExchangeADTopology              2756 Auto      Running OK   
       0 MSExchangeAntispamUpdate          2956 Auto      Running OK   
       0 MSExchangeDelivery                3020 Auto      Running OK   
       0 MSExchangeDiagnostics             1380 Auto      Running OK   
       0 MSExchangeEdgeSync                3116 Auto      Running OK   
       0 MSExchangeFastSearch              3192 Auto      Running OK   
       0 MSExchangeFrontEndTransport       3352 Auto      Running OK   
       0 MSExchangeHM                      1600 Auto      Running OK   
       0 MSExchangeIS                      3504 Auto      Running OK   
       0 MSExchangeMailboxAssistants       3612 Auto      Running OK   
       0 MSExchangeMailboxReplication      4080 Auto      Running OK   
       0 MSExchangeRepl                    2712 Auto      Running OK   
       0 MSExchangeRPC                     3708 Auto      Running OK   
       0 MSExchangeServiceHost             4148 Auto      Running OK   
       0 MSExchangeSubmission              4300 Auto      Running OK   
       0 MSExchangeThrottling              4516 Auto      Running OK   
       0 MSExchangeTransport               6392 Auto      Running OK   
       0 MSExchangeTransportLogSearch      4660 Auto      Running OK   
       0 MSExchangeUM                         0 Auto      Stopped OK   
       0 MSExchangeUMCR                    2928 Auto      Running OK   

The use of this script does mean it takes 20 minutes to start up the farm, but that’s time I’d probably spend any way waiting for the VMs to start up and then troubleshoot things to fix what is not working. Since I tend to work with these VMs for several hours at a time, the overhead of the script is minor, and I can easily work around the 20 minutes it takes!

Note also that we looked into the two known troublemakers and saw that all but UM was up and running. Given I’m not yet played with the UM part of the VMs, I’m OK with this for now. Maybe a bit more tweaking.

If you use the script above, test it out in your environment and adjust the sleep times to reflect how long things take on YOUR hardware.

No comments: