Lync KHI importer

The script will read CSV files that are created with the Lync 2013 KHI script: Create_KHI_Collection.ps1 It will process the CSV files and put the data in the by Microsoft supplied excel sheet: Lync_Server_2013_Key_Health_Indicators.xlsx

3.9 Star
1,875 times
Add to favorites
E-mail Twitter Digg Facebook
  • null-valued expression, and zeros for results
    1 Posts | Last post June 30, 2016
    • I'm running this for Lync 2010.
      The script appears to run correctly, but with occasional 'you cannot call a method on a null-valued expression' appearing in the the powershell window.
      Most of the values are being calculated.
      It runs for about 4.5 hours.
      When it's done, the excel file contains on summary sheet, with values, but the sheet for each server contains nothing but zeros.
      I'm not a scripting person (unfortunately :) ), so not exactly sure where the problem lies.
      Any help would be greatly appreciated.
  • Powershell Exception
    4 Posts | Last post June 19, 2015
    • Hello,
      great script and would prolly save me a lot of work. i just can't get it to run :(
      My setup i did run the script to create the collectors. Perfmon is logging. After this is done i copy the CSV file and continue work on my laptop.
      Opening local powershell with office suite installed. i receive the following errors multiple times.... I am using the latest version form networking guide 2.3 is this supported yet? Any help and a hint in the right direction would be really appreciated!
      You cannot call a method on a null-valued expression.
      At C:\KHIs\import_khi_data.ps1:590 char:4
      +             $ServerName = $ServerCSVFile.Split("_")[1]
      +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      You cannot call a method on a null-valued expression.
      At C:\KHIs\import_khi_data.ps1:592 char:5
      +                 $DatePart = $ServerCSVFile.Split(".")[0]
      +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      You cannot call a method on a null-valued expression.
      At C:\KHIs\import_khi_data.ps1:593 char:5
      +                 $ServerHeader = $ServerCSVFile.Split("_")[1] + " " + $DatePart.Split("_")[2]
      +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      Test-Path : Cannot bind argument to parameter 'Path' because it is null.
      At C:\KHIs\import_khi_data.ps1:598 char:18
      +             If (Test-Path $ServerCSVFile){
      +                           ~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidData: (:) [Test-Path], ParameterBindingValidationException
    • Hi,
      You need 2 csv files. One with the perfmon data collected from the server and one that contains all the names of the csv files you want to analyze with the servertype. 
      If you have this I guess the csv file does not have the correct seperator for the data fields. Can you post / send the content of the csv file?
    • Hi Wilfried,
      thanks for the hint - i got it working a classic layer 8 issue :) 
      I also can confirm that its working with v2.3 from the networking guide 
      cheers for the great script
    • Hi,
      I had a similar issue, where the script would just complain about not being able to call a method on a null-valued expression. I wasn't even aware I was doing such a terrible thing to it, and would certainly not want to be the cause of this hurt by forcing anybody to call methods on null valued expressions (while at the same time not denying those of their right to exist), but I was a bit disappointed by the empty Excel sheets this left me. So I dug into the script's inner workings to see what happened. 
      It turns out that when you use an absolute path for the KHIfile parameter, everything works fine, but when you use a relative path (which would happen when you use autocomplete on the file name, like I like to do), this call won't work:
      $WorkBook = $objExcel.Workbooks.Open($KHIFile)
      This results in an undefined $WorkBook variable, but won't prevent the script from trying relentlessly to write values to it...
      So I added these lines, just before this one: 'If (Test-Path $KHIFile)'
      if ($KHIFile.contains(".\"))
      	$KHIFile = $KHIFile.replace(".\", (Split-Path $MyInvocation.MyCommand.Path) + "\")
      	write-host "Updated KHFile parameter to '$KHIFile'"
      This rewrites the relative path, to an absolute one, resolving this minor issue with this otherwise great script. It's an absolute (again, not relative :) ) time saver!!!
  • Excel locale issue
    1 Posts | Last post December 23, 2014
    • I found that if I use a different locale setting than US, Danish in my situation, the script will fail.
      This can be bypassed by changing my system locale to US or adding this line to the script:
      Approx line 556:
      #Test if Excel file exists
      [System.Threading.Thread]::CurrentThread.CurrentCulture = New-Object "System.Globalization.CultureInfo" "en-US"
      Now it runs like a charm on my non-US system...
      /Kenneth ML
  • PhysicalDisk displacement
    3 Posts | Last post November 24, 2014
    • great script, huge time saver, thank you!
      When I run it against collected KHI csv files for a collocated lync FE (VM) the values for the physical disk in the summary page seem to be displaced by two rows. Tough to explain but I can provide a screen shot if you like. Any thoughts on how I can correct this?
    • Come to think of it, it looks like it happens in a few spots, or the averages aren't being calculated accurately. 
    • Hi KyleDS,
      The issue is mostly related to the fact that the current script is based on the v2 of the networking and I believe you are using v2.2.
      An update of the script to support v2.2 of the networking guide is in the planning.