Skype for Business Environment Report

This package of PowerShell scripts will gather data on a Skype for Business environment and store it into an XML data file. You can also create Microsoft Word reports and Microsoft Visio network diagrams based on the data gathered.

5 Star
913 times
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

  • Error While Creating Visio Diagram
    1 Posts | Last post September 28, 2017
    • Hi , 
      I am getting the following error message , can you please share the updated script so that we can test that one , i have read all the Q/A and i am not expert in Powershell , you havent mentioned where to change the script the new suggested changes. 
      Error As follows. 
      PS C:\Users\bilal.ali\Downloads\Cs Env Report v6.0> .\New-CsEnvDiagram.ps1 -EnvDataFile '.\ CS_Env_Data-092717
      Starting report creation.
      Importing CS Environment data file.
      Creating diagram: .\ CS_Env_Data-0927170430.vsdx
      Creating new instance of Visio to work with.
      Creating new Visio document.
      Adding page(s) to Visio document.
      Importing stencils...
      New-VisioDiagram :
      File not found.
      At C:\Users\bilal.ali\Downloads\Cs Env Report v6.0\New-CsEnvDiagram.ps1:1169 char:1
      + New-VisioDiagram -DataFileName $script:XmlFileName -CsConfig $CsConfi ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : OperationStopped: (:) [New-VisioDiagram], COMException
          + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,New-VisioDiagram
      Looking forward.
  • Error when creating Visio
    3 Posts | Last post September 21, 2017
    • Hi,
      I tried to create the Visio with New-CsEnvDiagram.ps1 but received the following error:
      Add-ShapeToPage :
      An exception occurred.
      At line:587 char:21
      + … ntOutline = Add-ShapeToPage -Shape “Rectangle” -Page $CurrentPage -X1 …
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : OperationStopped: (:) [Add-ShapeToPage], COMException
      + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Add-ShapeToPage
      Can I do something from my side to fix this?
      Thank you!
    • Hello Simon,
      Did you find a answer to this error ? I am having the same issue.
    • Same Problem here, any solutions?
  • Visio Script finishing error
    1 Posts | Last post September 20, 2017
    • When completed there are three lines at the end of the function that call Update-Status and the script stops.  This function doesn't exist.  Change these lines to Update-Log and the script will complete normally.
  • I'm getting this error
    2 Posts | Last post September 20, 2017
    • .\New-CsEnvDiagram.ps1 -EnvDataFile
      Starting report creation.
      Extracting CS Environment data file to C:
      Importing CS Environment data file.
      Creating diagram: SFB2016_new.vsdx
      Creating new instance of Visio to work with.
      Creating new Visio document.
      Adding page(s) to Visio document.
      Importing stencils...
      New-VisioDiagram :
      This file name is not valid.
      New-CsEnvDiagram.ps1:1169 char:1
      + New-VisioDiagram -DataFileName $script:XmlFileName -CsConfig $CsConfi ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : OperationStopped: (:) [New-VisioDiagram], COMException
          + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,New-VisioDiagram
    • See my post above and modify the script so that a page is added before the script tries to access it.
  • $NetInterfaces always contains in Report
    1 Posts | Last post September 20, 2017
    • It appears the collection does not complete this structure correctly. While the XML for the machine correctly references the object, the object only contains
      <Obj N="NetInterfaces" RefId="2262">
      <TNRef RefId="11" />
      Which results in the Report script variable $NetInterfaces having this value all the time.
      Primary 1
      External 1
      PSTN 1
      Also, FYI - the report script has an error when adding the IP Address(es) to the data table.  You have
      if($NetInterfaces {[void]$dt.Rows.Add("IP Address(es)",$NetInterfaces)
      which results in System.Object being put in the table.
      I changed this to 
      if ($NetInterfaces) { 
        $IPs = $NetInterfaces | Output-String
        [void]$dt.Rows.Add("IP Address(es)",$IPs.Trim)
      So now you get the object formatted for the text field (as if you had just output the object at the command line).
  • Exception when creating site pages after first - Resolved
    1 Posts | Last post September 19, 2017
    • The error occurs because the function New-VisioDiagram tries to set $CurrentPage to a non-existent page (and tries to define layers on it).
      To fix this, look in the function and find this line
      for($CurrentSiteNumber = 1; $CurrentSiteNumber -le $CsConfig.Topology.Object.Sites.Count; $CurrentSiteNumber++ ){
      Scroll down and look for this set of lines
      # Make sure there are enough pages for each site.
      if ($VisioPages.Count -lt $CurrentSiteNumber){$CurrentPage = $VisioPages.Add()}
      Cut these lines and insert them right after the "for" loop you found earlier and just before the comment "Select page for current site."
      This makes sure that a new page is added to the Visio diagram and sets $CurrentPage to this new one.  
  • Visio Diagram Error - op_Addition
    1 Posts | Last post September 19, 2017
    • Anytime the script tries to do something with $ExternalServers + $ExternalPools such as this example:
      $ExternalObjectCount = $ExternalPools + $ExternalServers | measure | select -ExpandProperty Count
      PowerShell throws an error
      Method invocation failed because [System.ManagementAutomation.PSObject] doesn't contain method named 'op_Addition'
      This does not happen with $InternalServers and $InternalPools
      For the example above I simply split the line into 3
      $ExternalPoolCount = $ExternalPools | measure | select -ExpandProperty Count
      $ExternalServerCount = $ExternalServers | measure | select -ExpandProperty Count
      $ExternalObjectCount = $ExternalPoolCount+$ExternalServerCount
      In other cases in the script I have managed to get around this by changing the code by duplicating the blocks of code these reference and only using $ExternalServer or $ExternalPools as follows
      foreach($Pool in $ExternalPools){
      where the original was
      foreach($Pool in $ExternalPools+$ExternalServers
      This works for most of the blocks.  You just have to be sure that you don't reset the index being used to determine where (X,Y) the object is being placed
  • Error in External DNS collection
    4 Posts | Last post September 19, 2017
    • When running the collection I am getting a loop in the external DNS collection:
      Getting external DNS records.
      *** Request to UnKnown timed-out
      *** Request to UnKnown timed-out
      The server running the collection has internet access. After about 55 of these time out messages the script continues.  Something that I should be concerned about?
    • Answering my own question - nslookup to external DNS is blocked by our Information Security team except on domain controllers.  The challenge is now how to run this on a domain controller.  Experimenting with Remote PowerShell so that we don't have to install SfB Admin tools.
    • There is a way around the problem you're seeing. Copy the extracted XML file to a machine that has access to external a DNS server, the code below uses Google @, and run the following. It will import the XML file into your PowerShell session, enumerate the external DNS records, and perform the lookup for each before saving the information back to the XML file.
      $CsConfig = Import-Clixml "Path\To\XML.File"
      foreach($Record in $CsConfig.EnvironmentData.ExternalDNS.GetEnumerator()){
      	$DNSRecord = $Record.Name
      	$SRVRecord = $DNSRecord -match "_"
      	try {
      		$NSLookup = $null
      		$NSLookupResults = $null
      		$NSLookup = "nslookup.exe"
      		if($SRVRecord){$NSLookup = "$NSLookup -timeout=1 -type=srv"}
      		$NSLookup = "$NSLookup $DNSRecord"
      		$NSLookupResults = Invoke-Expression "$NSLookup"
      		if ($SRVRecord){
      			$DNSRecordTarget = @()
      			for ($i = 4; $i -lt $NSLookupResults.Count; $i++){$DNSRecordTarget += ($NSLookupResults[$i].Replace("  ","")).Trim() + "`n"}
      		} else {
      			$DNSRecordTarget = @()
      			for ($i = 4; $i -lt ($NSLookupResults.Count - 1); $i++){
      				$Address = $NSLookupResults[$i].Replace("Addresses:","")
      				$Address = $Address.Replace("Address:","")
      				$DNSRecordTarget += $Address.Trim()
      	catch {
      		$DNSRecordTarget = "ERROR"
      	$Record.Value = $DNSRecordTarget
      $CsConfig | Export-Clixml -Path "Path\To\XML.File"
    • A bit late but just wanted to let you know that this worked!
  • New-CsEnvReport.ps1 error
    3 Posts | Last post June 02, 2017
    • I'm also getting this error when i run new-csenvreport.ps1.  It works great for a minute or two, chugging along and setting up the Word doc, but then dies on "Creating LisSubnet policy table"  Here's the error...
      New-WordTable : The number must be between 1 and 63.
      At S:\Restore\NEW\New-CsEnvReport.ps1:495 char:5
      + ...             New-WordTable -DataTable $dt -HeaderRow $true -FlipData $ ...
      +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : OperationStopped: (:) [New-WordTable], COMException
          + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,New-WordTable
    • The LIS & RGS sections can be a bit flaky. As a temporary workaround you can comment out the sections for them from the report. You would just need to add a # at the beginning of line 401 for RGS or 403 for LIS. I will do some additional testing and validation for the next release the see if I can figure out the issue. 
    • Do you have a fix for this?  LIS and RGS are needed in the report.
      Thanks very much.  :)
  • Any suggestions?
    1 Posts | Last post June 02, 2017
    • Someone else mentioned this too, but i don't see that an answer was given.  When running the script to create the Visio diagram, i'm getting this error:
      New-VisioSitePage : Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
      At C:\Scripts\LyncEnvReport\v6\New-CsEnvDiagram.ps1:621 char:3
      +         New-VisioSitePage -Site $Site -CurrentPage $CurrentPage
      +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (op_Addition:String) [New-VisioSitePage], RuntimeException
          + FullyQualifiedErrorId : MethodNotFound,New-VisioSitePage
      How can i fix this?
      Thanks again. Awesome script!
1 - 10 of 18 Items