Skype for Business Online – ACP Info

I was recently approached to grab some conferencing information for all of our users. Unfortunately, that information is not easily retrieved via the various canned reports in the Office 365 reporting portal. So – PowerShell to the rescue!

The interesting thing about ACP info for users is that it is a property encoded in XML. At first, it may seem terribly un-admin-friendly. However, if you know how to work with XML within PowerShell, it’s actually pretty awesome. Let’s look at this.

After you connect to Skype for Business Online PowerShell (instructions here) , when you run “Get-CSOnlineUser username | fl AcpInfo“, you’ll get something like this:

Notice each element available here – TollNumber, TollFreeNumber, etc… This is not very useful if you have to pull it out to create a report on each of your users as it will just be a string of text. So let’s fix this so we can take a look at each element, pull them out separately, and even export them to CSV:

The one liner above looks like there is a lot going on, but it’s actually not terrible. Let’s try to break it out:

@{….} – This is the starting point for your hash table, with the “stuff in the middle.

n=’ProviderName’ – This is the name of one of your columns. You can call this anything you want.

; – this is a line break

e={([xml]$_AcpInfo).AcpInformation.name} – This is your expression – essentially, it’s the information that will end up in your column. Notice how I specifically caste to XML. This bit is important because it’s the key to making it work. If you practice with this, you’ll get really good at manipulating XML data in PowerShell.

The rest of the command just follows suite with this continuing with each element you want to pull out of the AcpInfo property.

Now, this is great if you want to display it on screen, but what about exporting to CSV to create a more useful report. Easy – just pipe the above command to Export-Csv!

That’s about it! Now you can hand over a report to the powers that be with all the conferencing information for your users.

Enjoy!

*BONUS TIP!

With regard to the CSV file above, I’ve found that opening the CSV file directly in Excel is frought with problems, especially when there are non-text elements. Excel, like a helpful assistant, tries it’s best to know what data you want and how you want it formatted. Unfortunately, more times than not, it’s wrong – ugh… So whenever I export to CSV from PowerShell, I open a blank Excel spreadshet and I then IMPORT the data. Here is how I do it:

  1. Open Excel and start a blank worksheet.
  2. On the Data tab, click Import from Text and select the CSV file you created.
  3. In the Text Import Wizard, make sure that “My data has headers.” is checked and click Next.
  4. Now, UNcheck Tab, and CHECK Comma and click Next.
  5. Here, choose Text instead of General, click Finish.
  6. In the Import Data window, choose where you want the data. Normally, just leaving the defaults and clicking OK is sufficient.
  7. Now you should see your data as you intended to view. ALSO, if you need to read information from this file into a variable or another PowerShell command, the formatting will be 100% correct and readable by Import-Csv.
Advertisements

Leave a Reply

Your email address will not be published. Required fields are marked *