Yearly Archives: 2013

How do I find the Cisco MSE Version Number via command line?

If you are trying to find the version number of your Cisco Mobility Services Engine, SSH into the machine and execute the following command:
/etc/init.d/msed status

You should see something similar to the output below:

[root@MYMSE ~]# /etc/init.d/msed status
STATUS: Starting MSE Platform, Waiting to check the status. MSE Platform is up, getting the status

-------------
Server Config
-------------

Product name: Cisco Mobility Service Engine
Version: 7.0.220.0
Hw Version: V01
....

Hope this helps!

How to validate numeric-integer input in C

I had one of my buddies ask me how to validate input in C today... Turns out the task is kind of daunting. I thought I could get away with the following below:

int status, input;
status = scanf("%d", &input);
while(status!=1){
	printf("Incorrect number... please try again: ");
	status = scanf("%d", &input);
}

but the problem is you receive an infinite loop. The reason behind this is when you hit return\enter on your keyboard, a newline character is passed in as input. These extra hidden characters are what is messing with your input and spawning the infinite while loop. Luckily, I was able to parse through the extra characters one-by-one and get something working.

Hopefully this helps someone else!

#include<stdio.h>
int main(void){
	// input	user input -- hopefully a number
	// temp		used to collect garbage characters
	// status	did the user enter a number?
	int input, temp, status;

	printf("Please enter a number: ");
	status = scanf("%d", &input);
	while(status!=1){
		while((temp=getchar()) != EOF && temp != '\n');
		printf("Invalid input... please enter a number: ");
		status = scanf("%d", &input);
	}

	printf("Your number is %d\n",input);
	return 0;
}

How to activate Lync Evaluation to Licensed Version

Have Lync 2010 Standard, Enterprise or Lync 2013 in evaluation mode and want to activate it with your licensed version? Here are the steps to do it!

  1. Download the Lync Server version from the Microsoft Licensing portal (or where ever else you obtain your licensed software).
  2. Extract the ISO to a folder/burn it to a disk and pop it into the Lync server.
  3. Open up the Lync Server Management Shell as an Administrator
    1. Start->All Programs->Microsoft Lync Server 2010 (or 2013)->Lync Server Management Shell
  4. Navigate to the installation media
    1. cd PATHTOYOURLYNCSERVERINSTALLER\Setup\amd64\Setup
  5. Execute the following command
    1. msiexec.exe /fvomus server.msi EVALTOFULL=1 /qb
  6. Use the following command to update the services
    1. Enable-CsComputer
  7. Use the following command to verify your copy of Lync is now licensed
    1. Get-CsServerVersion

 

How to prevent users from adding a machine from Active Directory - the domain

Interestingly enough, by default Microsoft's Active Directory ships out with the ability for all Authenticated Users to join their machine to a domain up to 10 times.  Why 10?  Who knows.  Personally, I do not want my users to be able to add machines to the domain, so the steps below can be achieved to prevent these actions.

  1. Logon to one of your domain controllers or a machine with ADSI Edit
  2. Open up ADSI Edit
    1. Start->Administrative Tools->ADSI Edit
  3. If you have logged into one of your DCs, you can leave the Name, Connection Point, and Computer to default, otherwise enter in the proper information to connect to your DC and click OK.
    1. Image of default settings to connect
    2. ADSEI Edit - Connection Settings
  4. Expand the context that was added and right click on DC=[domain],DC=[TLD] and click Properties.
    1. ADSI Edit - Properties
  5. Scroll down to ms-DS-MachineAccountQuota and click Edit
    1. ADSI - ms-DS-MachineAccount
  6. Change the Value of 10 to 0, click OK
    1. ADSI Edit - Integer Attribute Editor
  7. Click OK on the DC=[domain],DC=[TLD] dialog box

At this point, users inside of the Domain Admins or Enterprise Admins groups will only be able to add machines to the domain.

How to move a column in a table in mySQL

Execute the following query:
ALTER TABLE mytable MODIFY COLUMN columntobemoved INT AFTER columnbefore;

mytable = the table you are modifying
columntobemoved = the column that will move in the table
columnbefore = the column that will be before the column you move. I.e. if you have columns a, b, c and you want to put columntobemoved after b (so between b and c), you would use b as the columnbefore value

 

msSQL Server 2008 R2 - Restore Failed

Symptom: When restoring a database in Microsoft SQL Server Management Studio, you receive the following dialog box similar to something below:

Restore failed for Server 'myserver'. (Microsoft SqlServer.SmoExtended)

Additional Information
System.Data.SqlClient.SqlError: File 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\mydatabase.mdf' is claimed by 'mydatabase_FG1'(3) and 'mydatabase'(1).  The WITH MOVE clause can be used to relocate one or more files. (Microsoft.SqlServer.Smo)

Solution: On the Restore Database - mydatabase window inside of Microsoft SQL Server Management Studio:

  1. Click on the Options page.
  2. Underneath Restore the database files as: label, make sure all of the "Restore As" values are unique.  In this case, I renamed each *.mdf file to it's "Original File Name" column value.
    1. Before
      1. Restore Database msSQL
    2. After
      1. Restore Database msSQL
  3. Click OK

Viola!  Your database should now successfully restore 🙂

Managing Adobe Reader files with iTunes - on your iPad or iPod Touch

This tutorial assumes you already have iTunes setup, you are logged into it with your Apple account, and your iPad has been synchronized to your iTunes account.  Also, this guide assumes you are using an iPad, but I believe the steps are the same for an iPod touch as well.

  1. Open up iTunes
  2. Plug-in your iPad
  3. Press the Alt key, click on the View menu, and then select Show Sidebar
  4. Getting to the Adobe Reader app on your iPad
    1. Select your iPad
      1. Selecting your iPad
    2. Click on Apps in the top middle of the screen
      1. Selecting Apps
    3. Scroll down and click on the Adobe Reader app
      1. Adobe Reader App
  5. To add files to your iPad
    1. Click on the Add button
    2. Navigate to the folder you want, hold the control key, and select the files you want to send to your iPad (they must be in pdf format)
    3. Maps
    4. Click Open (note you cannot upload folders to your iPad)
  6. To backup files from your iPad to your computer
    1. Click on the folder you want and click on the Save To… button
    2. Navigate to the folder you want to place the folder in (iTunes will create the folder inside of the folder you are selecting).
    3. Select Folder
    4. Click the Select Folder button (you do not need to type in anything, just click the button)
      1. At this point, if you were to navigate to your folder, you should see the folder you selected in iTunes, and then inside of that folder, the folder you selected to backup.
        1. Note: iTunes doesn't copy files from the folder you selected, it copies the folder and sub-items in it to a new folder that you selected.
  7. To create folders on your iPad, do the following:
    1. Launch the Adobe Reader application
    2. Click on Documents on the left side
    3. Click the Edit button in the top right
    4. Click on the Folder icon with a + sign on it
    5. Type in the folder name and click Save
  8. To move PDFs into a folder, launch the Adobe Reader app on your iPad (NOTE: you cannot drag the files inside of iTunes into the folders)
    1. Click on Documents on the left side
    2. Click the Edit button in the top right
    3. Find your PDFs and click on the little Circle icon next to it
        1. When you do that, it should turn red with a check mark
    4. Click on the icon with a diagonal arrow on a folder
    5. Click Move selected documents
    6. Select the folder you want to move the PDFs to

Lync 2010 - Deploying Monitoring Server Reports

I recently had the lovely experience of setting up the monitoring role for Lync 2010.  In doing so, I documented the steps I took to successfully deploy the Monitoring Server Reports Services.

Before beginning, here are a few notes:

  • Ensure you are using Microsoft SQL Server 2008 x64 Standard or greater (if you need to upgrade, see the following tutorial: SQL Server 2008 R2 – Updating a msSQL instance/server)
  • You have deployed Lync 2010 Standard or Enterprise
    • Both versions allow you to add this service

Alright, so lets begin!

  1. Our first step is to install the "Reporting Services" feature for SQL Server 2008
  2. Open up the Reporting Services Configuration Manager
  3. Enter the SQL Server Reporrting Services instance you want to connect to
  4. Click Web Service URL
  5. Enter the virtual directory name, port, and configure your SSL certificate
  6. Click Apply
    1. Note: If you had IIS on this box, you will need to choose different port numbers
  7. Open up Microsoft SQL Server Management Studio
  8. Login to your SQL server and create a new service account for your SQL server
    1. Make a sysadmin for the time being
  9. Head back over to the Reporting Services Configuration Manager
  10. Setup the Database Name and select the language.
  11. Leave Native Mode selected and click Next.
  12. Enter the same credentials on the Credentials step and click Next
  13. Click Next on the Summary pane
  14. Click Finish
  15. Go back to your SQL Server and deprivilege your account
    1. Uncheck sysadmin and Set the default database to ReportServer
  16. Click on the Report manager URL in the reporting Services Configuration Manager
  17. Click Reports if you are happy with the /Reports directory
  18. Once you have clicked Apply, verify you can view the website by clicking on the link it shows (it should bring you to a site that kind of reminds you of an old version of sharepoint :P)
  19. Go to your Lync Front End server and run the Lync Server Topology Builder program (Start->All Programs->Microsoft Lync Server 2010->Lync Server Topology Builder)
  20. Upon login, check "Download Topology from existing deployment" and click OK
  21. Save the topology to your desktop when prompted (or anywhere else, doesn't really matter)
  22. Expand your Site, and click on the Monitoring Servers folder
  23. Right click on Monitoring Servers and select New Monitoring Server...
  24. Enter in the server to install the role on
  25. Enter the SQL server name/instance to use
  26. Finish the installation
  27. Head over to the server where you are going to install the Monitoring/Archieving role
  28. Open up the Lync Server 2010 - Deployment Wizard (run as administrator)
  29. Click on Install or Update Lync Server System
  30. Click on Setup or Remove Lync Server Componenets
  31. Let it install/configure all of its stuff
  32. Click on Run next to Server Status (Optional)
  33. Verify Lync Server Call Detail Recording and Lync Server QoE Monitoring Service services have been started (start them if they aren't running)
  34. Go back to the Lync Server 2010 deployment wizard homepage and click on Deploy Monitoring Server Reports
  35. The server information should already be prefilled in. Click Next
  36. Enter in the SQL credentials needed to connect in
    1. For this step, I would recommend creating the account yourself (A good tutorial I came across on doing this can be found here, but I have summarized the steps below):
      1. Head over to Active Directory and create a new user
      2. Head over to the SQL Server
      3. Right click on Security->Logins and click New Login...
      4. Enter in your AD account you just created
      5. Click on User Mapping
        1. Check both the LcsCDR and QoEMetrics databases
      6. Click OK
        1. Do the following for both the LcsCDR and QoEMetrics databases
          1. Expand the database, expand Security, export Users
          2. Right click on the user you mapped to the database and click Properties
          3. Check ReportsReadOnlyRole and click OK
  37. Enter in the User Group you want access to run reports.
    1. This group is a list of users who have access to actually run the reports/will point and click on reports.
  38. Click Next, you should notice the following info when it starts configuring, that is normal:
    1. The following URL will be used for deployment: https://myserver.mydomain:443/ReportServer SQL Server logon credentials for "mydomain\myuser" already exist. Use the existing logon credentials. "[QoEMetrics]" role "[ReportsReadOnlyRole]" has already assigned to "mydomain\myuser". "[LcsCDR]" role "[ReportsReadOnlyRole]" has already assigned to "mydomain\myuser".
  39. Click Finish (Assuming all went OK) 🙂
  40. Head over to your Lync admin panel (web GUI)
  41. Click on Monitoring and Archiving
  42. Select Global and click on Action and select Enable CDR
  43. You can change any other settings in here to your preference at this point.
  44. Head over to your reports page. https://yourdomain/ReportServer
  45. Click on LyncServerReports
  46. Click on Reports Home Page

If you see the Monitoring Server Reports page with the Lync 2010 logo in the top left corner, get up, celebrate, and pat yourself on the back! 🙂

Other thoughts: The first time I deployed this, I ran into a ton of errors.  I have documented many of these issues and other issues that you might run into during your deployment.  Hopefully you don't run into any, but if you do, hopefully they help you get up-and-going again.

Lync 2010 – Publishing the topology error: Missing Machine

SQL Server 2008 R2 – Reporting Services Configuration Manager – Create certificate binding failed – HRESULT: 0×80040238

SQL Server 2008 R2 – Reporting Services Configuration Manager – The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

Lync 2010 – The feature: “Customizing security roles” is not supported in this edition of Reporting Services.

Lync 2010 – Cannot impersonate user for data source ‘CDRDB’. (rsErrorImpersonatingUser) error