Windows PowerShell Makes It Easy to Print or Save Data

 

Topic Last Modified: 2013-12-13

This probably won’t come as a major surprise, but one of the things that the Lync Online Admin center shows you is a list of all your users who have been enabled for Lync Online:

The Lync Online Admin center.

That’s handy information to have at your disposal, so handy that you might actually want to save that data to a file. So how do you use the Admin center to save data to a file? Short answer: you don’t. The Lync Online Admin center doesn’t provide a way to save, or to print, whatever you’re viewing on screen. And even trying to copy and paste all that data is only minimally useful.

NoteNote:
In all fairness you can copy the data and paste it into Excel. That will work for the most part, although you’ll probably have to clean up the formatting a bit. Plus, you’ll have to do this for each screen of user accounts. Oh, and you’ll have to work around the fact that the Admin center can only display 1,000 users at a time.
But, other than that, it’s a piece of cake.
We should also note that the Exchange Admin center enables you to save some items to a text file. But you can’t save everything, and currently Exchange is the only Office 365 component that offers this capability.

So how do you save this data, or, for that matter, how do you save any of your Office 365 data? The answer is – well, you’re way ahead of us. Yes, the answer – as usual – is to use Windows PowerShell. Want to save your Lync Online user data to a CSV (comma-separated values) file, a file that can be easily opened in Excel? All you had to do was ask:

Get-CsOnlineUser | Select-Object DisplayName, UserPrincipalName, UsageLocation | Export-Csv -Path "C:\Logs\LyncUsers.csv" -NoTypeInformation

Does that work? Would we have picked this example if it wouldn’t work:

Lync Online user data displayed in Excel.

And before you ask, yes, we could also save this as an XML file, or as an HTML page. In fact, with a little additional coding (coding goes beyond the scope of this article) we could save it directly as an Excel file, with any custom formatting we desired.

And what if you wanted to print directly from Windows PowerShell, without having to go through Excel or some other application? Well, it won’t be the fanciest looking printout you’ve ever seen, but this command will do the trick:

Get-CsOnlineUser | Select-Object DisplayName, UserPrincipalName, UsageLocation | Out-Printer

And here’s what your printed document will look like:

Print Lync Online user information.

That might not be a work of art, but it is a printed document. And that’s something you just can’t get from the Admin center.


Next: Windows PowerShell Lets You Do "Cross-Product" Management

 
Show: