Lync Topology Builder error: "The directory name is invalid"

Earlier this week I had a project where we were moving the back-end Lync database from a standalone SQL to a clustered instance (pilot to production for Enterprise Voice!), but we ran into an error I haven't hit before when trying to add the new SQL store to the topology - Topology Builder was failing on the enabling topology step with the error "The directory name is invalid." As a result the databases and permissions were not even being populated in the new instance.

We checked the usual suspects: firewalls, permissions, etc with no luck. In the end we just used a different machine that had Topology Builder installed and the same topology file published OK. After doing some more research it seems this is a very generic SQL error that can typically be resolved with a reboot (of the server trying to talk to the SQL instance). So if you hit this error I would suggest just using a different machine, or restart the one you're using.

Topology Builder MMC Crash

With my most recent Lync project I found Topology Builder crashing when I went to try and publish a brand new topology. I started with the basics and verified I had all the correct group membership for my account and that the SQL server was accessible. The server I was publishing from was 2008 R2 SP1 with all the latest patches, but even after a reboot I would get the following MMC crash as soon as I clicked on publish:

Description:
Stopped working

Problem signature:
Problem Event Name: APPCRASH
Application Name: mmc.exe
Application Version: 6.1.7600.16385
Application Timestamp: 4a5bc808
Fault Module Name: KERNELBASE.dll
Fault Module Version: 6.1.7601.17651
Fault Module Timestamp: 4e21213c
Exception Code: e053534f
Exception Offset: 000000000000cacd
OS Version: 6.1.7601.2.1.0.272.7
Locale ID: 1033

In order to troubleshoot errors like this further you can dig in to the log files Topology Builder generates which can be found in the %APPDATA%\Local\Temp folder. I found the real issue by sorting the files in this folder by last modified date which pointed to the Create-CentralMgmtStore log file. Opening this up I noticed the following section:

Installed SQL Server 2005 Backward Compatibility version is 8.05.2312
Connecting to SQL Server on <SQL Server FQDN>
SqlMajorVersion : 10
SqlMinorVersion : 0
SqlBuildNo : 4000
SQL version is acceptable: 10.0.4000.0
Default database data file path is M:
Default database log file path is L:
Error: dbpath must be a fully qualified drive and path, ie c:\sql\db

Notice the final line which points out the database path requires a drive and path. I had been selecting the option to use the SQL database default paths for the CMS and FE pool databases, but these DB paths were simply a drive letter. Since this is considered invalid for Lync I modified the SQL instance default paths to include a folder after the drive letter.

After this change the topology published just fine.

Using the Lync Topology Validator

A very useful utility found in the Lync Resource Kit tools download is the Topology Validator application which automatically runs a series of synthetic transactions to help validate a deployment is working properly. The tests run by the tool are all synthetic transactions an administrator could execute at a any time, but the advantage to Topology Validator is it can run all of the tests one after another.

To get started with the Topology Validaor first install the Lync Resource Kit tools. After that we need to generate a copy of the latest topology. Since simply saving a copy of the topology via Topology Builder doesn't actually generate a valid file for the tool so open up the Lync Server Management Shell and run the following command:

Export-CsConfiguration -FileName C:\Latest.zip

Now extract the zip file and copy the DocItemSet.xml file to the location of the Topology Validator installation. By default this will be C:\Program Files\Microsoft Lync Server 2010\Reskit\TopologyValidator. I would also rename this file to something like Topology.xml.

You can run the Topology Validator executable manually, but the easiest method is to edit the SampleInput.xml file found in the same folder to suit your environment. This allows you to pass the input file to Topology Validator and avoid entering parameters for the pools and users for each test.

Something else to keep in mind is that you can use the two user accounts configured in a CsHealthMonitoringConfiguration, but there are some tests (such as the phone bootstrap) which cannot be run when this option is selected. For this reason I recommend entering the test user accounts in the input file instead of electing to use the preconfigured accounts. These can be the same accounts, but you just need to make sure the usernames and passwords are included in this file. Be aware the usernames and passwords used for testing are stored in clear text within this file.

Once the test user accounts have been created and enabled on the Lync server pool make a copy of the Sample Input file and name it Input.xml before editing. I typically remove the content between the nodes in the global section. There are also two pool nodes defined by default, so you can use different settings against multiple pools, but you can remove one section if you're only testing a single pool. Important sections to fill out are:

      Topology: The file name and extension of the topology file to be used.
      Pool FQDN: Fully-qualified name of the pool to run tests against.
      TargetPstnPhoneNumber: Phone number to be dialed by your user. I did not have much luck with this number being normalized before dialed so I included a fully normalized version.
      User: For the users in the pool you should miniminally define the SipUri, UserName, and Password. You can also define a phone URI and PIN for some of the PSTN and device tests to run successfully.

My final Input.xml file is listed here:

<?xml version="1.0" encoding="utf-8" ?>
  <TopologyValidatorInput xmlns="urn:TopologyValidatorInput-Schema">
      <Topology>Topology.xml</Topology>
  <GlobalSettings>
    <Settings>
    </Settings>
  </GlobalSettings>
  <Pools>
    <Pool Fqdn="fblyncse.fabrikam.net">
      <Settings>
        <TargetPstnPhoneNumber>+441794321321</TargetPstnPhoneNumber>
        <Users>
          <User SipUri="sip:lynctest1@fabrikam.com" UserName="fabrikam\lynctest1" Password="pass@word1" Phone="+14252555000" Pin="12345" />
          <User SipUri="sip:lynctest2@fabrikam.com" UserName="fabrikam\lynctest2" Password="pass@word1" Phone="+14252556000" />
        </Users>
      </Settings>
    </Pool>
  </Pools>
</TopologyValidatorInput>

To run the tool open a command prompt (you must run it with elevated rights) and move into the TopologyValidator directory:

CD C:\Program Files\Microsoft Lync Server 2010\Reskit\TopologyValidator

Now initiate the tests with this command:

TopologyValidator.exe  /file:Input.xml

The tool will take some time to run through each of the tests, but you'll see the output begin scrolling as each test is executed. Don't worry if you don't catch all the status it reports - at the end of all the tests you'll be presented with a web page showing the summary.

This isn't a definitive way to validate a Lync deployment, but it does provide a quick starting point to verify the core services are functioning properly.