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.

Thursday, October 24, 2013

Replace PowerShell with the Command Prompt–But WHY?

I get a customised Google News page which brings up, amongst other things, recent news about PowerShell. This is a nice way of keeping up to date with news specifically about PowerShell and other things I am interested in.

This week, the applet I use to get news brought up an article entitled Replace PowerShell with the Command Prompt. I immediately clicked the hyperlink to discover details on how to change the Win+X Menu in Windows 8.1 back to Cmd.Exe.

WHY??? I felt myself asking! WHY Why anyone actually want to go backwards. A bit like replacing Notepad with a link to Edlin (or VI) if you ask me. Almost all the traditional command line tools work perfectly in PowerShell. You use them with identical syntax and all that even if the output is just text and not objects they function just fine. A few applications use syntax that trips up PowerShell – but with the use of the the –% operator, you can continue to use the older syntax (as I describe in a Blog article titled Taming Wild Console Applications in PowerShell v3.

If you are using Windows 8.1, you should know by now that PowerShell is the future (and present!). Get used to it and learn to love it. And please, resist the temptation to go back!

Technorati Tags:

Wednesday, October 23, 2013

The Root-Servers vs. the RootServers–a DNS mystery

I was working today with Nslookup running against the root servers to see what responses I got, and what the TTL times were for records retrieved were.  When I first tried, I got some really weird results:

image

This really didn’t make any sense – since when did the responsible person for the root servers on the internet devolved to buydomains.com? Then I noticed the problem. Look carefully at the SOA I was trying to resolve. Retying the command with a strategic adjustment yielded success:

image

So the mystery was easy – my typing stinks. But if I can make that mistake, no doubt others might.

 

Technorati Tags:

Wednesday, October 16, 2013

Lync Server Test Drive–Discovering SQL Servers

In a recent blog article, I wrote about the Lync Server Test Drive Virtual Machines that Microsoft had put up for use. This is a huge set of VMs, but it all does work. With the VMs up and running, I can now begin to write some scripts against this VM set.

Today’s script, Get-SQLServer2.ps1 uses the SQL Server SQL Management Objects (SMOs) to discover the SQL instances in use on the network (the subnet used by the Test Drive set). The link points you toward the  actual script which you can download and use!

The core of the script is accomplished by one line:

$SQLservers=
[System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources()

This statement used the SMOs to enumerate the instances of SQL on the local net. However, $SQLServers is returned not as an array but as a Data Table containing Data Rows (one per instance). So in order to convert this back to being AN array of Data rows, I use this logic:

$Srvs = @()
Foreach ($srv in $SQLServers) {
$srvs += $srv
}

Once I have these instances in an array, I can print them out like this:

"There are {0} SQL Server(s) on the Local Subnet" -f $Srvs.count
$Srvs | Select ServerName, InstanceName, Version | Format-Table -AutoSize

So as you can see from the output, there are a total of 7 instances of SQL server in the Test Drive network.

The joys of PowerShell and SMOs. I’ll be both documenting SMOs more here as well as diving down into the Lync Databases in coming articles.

 

Saturday, October 05, 2013

Lync 2013 PowerShell Module–An Overview

In an earlier article, I wrote about the new Lync 2013 Test Drive. This is a set of 7 Virtual Machines that implement Lync for you to play with. These VMs enable you to test out and work with Lync Server 23013. SharePoint is also included in the Test Drive – although that’s probably a subject for a separate blog post or posts.

So what’s the first thing to look at? Well, for me, as a PowerShell guy – the first thing is obviously the Lync module. You can get the Lync Module either by using the Lync Console shortcuts provided when you install Lync. Alternatively, you can use it directly from a PowerShell console running on any system that has the Lync tools loaded.

You import this module by using the Import-Module cmdlet. With PowerShell V3, you do not really need to import the module explicitly, as by using any cmdlet, you get the module auto-loaded for you. And of course, you can turn this auto-load feature off should wish to. The Test Drive VMs all utilise PowerShell V3.

When I load the Lync module, the first thing I do is to look at how many cmdlets are contained in the Module. That was easy, although I was very surprised at the result:

image

As you can see by following the red arrow – there are 739 cmdlets in the Lync module. Now I’m not sure what YOU think of this, but my immediate reaction is astonishment. That’s a lot of cmdlets to learn. The good news is you can use PowerShell’s discovery features to help.

First, let’s look at the verbs that are used in these cmdlets. I find the verbs give a feeling of what sorts of actions we are expecting the cmdlets to perform. I use a simple one-liner to work out what verbs are used in Lync Cmdlets – which looks like this:

image

As I count it, that makes for 35 verbs, although 12 verbs are used just once, and 5 are just used twice. Interestingly, just over 3/4 of all the cmdlets use Get, Set, New or Remove which isn’t too surprising.

A more interesting bit of output would be the nouns used in the cmdlets. The nouns represent the different types of objects that you are going to manage with a module. While verbs, in cmdlet names, are generic and standardised, it’s the nouns that are task specific.

In the case of Lync, there are a large number of different nouns:

image

TWO HUNDRED EIGHTY FOUR nouns. If your jaw dropped with the number of cmdlets, there are 284 separate objects which are used as the target of one or more Lync Cmdlets. This is also a pretty big job in terms of the documentation – since each of these cmdlets and the objects they interact with need documentation.

So how do you get started?  In some coming blog posts, I’ll be taking a look at the various sub-sets of cmdlets and introduce them to you!

Wednesday, October 02, 2013

Lync Server Test Drive: Pre-Configured Virtual Machines

One of the things, missing until recently, that Lync customers have wanted is a set of demonstration VMs to get a feel for Lync, without the pressure of having to install it themselves. Lync installation is a very complex process and for basic evaluation – in my case just testing small features (PowerShell related of course) would have meant a huge amount of work to get all the bits and bobs loaded and configured. Like so many, I just do not have time.
A recent mail form those very nice people in the Lync product group, I found Microsoft has now released just what I and others were asking for. The Lync Server Test Drive is a set of seven Virtual Machines: A domain controller, and Exchange Server, a Lync FE Server (running Lync SE), a Management Server, a SharePoint server, a WAC server (for conferencing) and finally a system for development. You don’t need all of these VMs, and you can download them in sets. There are three sets:
Set 1 – which you can get from http://www.microsoft.com/en-gb/download/details.aspx?id=40266, contains:
  • DC – a configured DC in the Contoso fictional domain
  • Exchange – a configured Exchange 2013 server configured with almost 250 accounts!
  • Lync Front End – running Lync 2013 Standard Edition
  • WAC – for conferencing
Set 2, which you can get from: http://www.microsoft.com/en-us/download/details.aspx?id=40267, contains 
  • Lync Management server
  • SharePoint Server
Finally, Set 3, which you can get from: http://www.microsoft.com/en-gb/download/details.aspx?id=40265, contains:
  • A TS server, which you can used to develop Lync based applications and a bit more!
Each of these sets comes as several compressed files, which are huge. The 62 files that make up the raw download take up just under 46GB of disk space. Expanded and running, the VMs take up a whopping 175 GB. That’s over 220GB of disk space. You could download a bit, expand the downloads then delete the downloads if you were on the short side for disk storage – but you’ll still need 175 GB of disk for the vms themselves.
Here’s what I see after importing the VMs:
image

The VMs also require a pretty hefty Hyper-V host, particularly given the Memory needs.  In order to get these running, I upgraded my Precision w7500 server box to 32 gb of ram. I would have bought more, but the 8GB sticks of Ram are pretty pricey – and besides, 32 GB if 4 times the largest ram I’ve ever installed
In operation these VMs are not what I’d call fast. If nothing else, this confirms that to really run Enterprise software like Lync  you need RAM, processing power and fast disks! As in most classroom scenarios, starting the VMs all at once means a lot of services do not start cleanly – but it’s nothing that a bit of PowerShell can’t quickly remedy. Having said that, once it’s all up and running, things seem to work well.
It’s great to have a fully working set of VMs I can now play with! I hope to generate some more cool scripts soon!