Topic Last Modified: 2013-07-05
When you connect to Lync Online by using Windows PowerShell, approximately 40 Lync Online cmdlets will available for your use. However, you are not limited to using just those 40 cmdlets when managing Lync Online. In addition to the Lync Online cmdlets, you can also use any other Windows PowerShell cmdlets that are installed on your computer. (When you install Windows PowerShell 3.0, hundreds of core Windows PowerShell cmdlets are installed, as well.) Your commands can mix and match Lync Online cmdlets and any other cmdlets available on your computer.
Although a complete course in Windows PowerShell 3.0 goes beyond the scope of this article, here are a few examples that show why you might want to mix and match cmdlets. First of all, none of the Lync Online cmdlets include a Print command, and no such command can be found in the Windows PowerShell console, either. So how do you get a printout of the information retrieved by a cmdlet? One way is to retrieve the information, and then send that information to the Out-Printer cmdlet:
Copy Code | |
---|---|
Get-CsTenant | Out-Printer |
Because no additional parameters are included, all the information returned by the Out-Printer cmdlet will be printed to the default printer.
Likewise, none of the Lync Online cmdlets include a parameter that allows you to save data to a file. But that’s OK: this command uses the Out-File cmdlet to save the returned information to the text file C:\Logs\Tenants.txt:
Copy Code | |
---|---|
Get-Tenant | Out-File -FilePath "C:\Logs\Tenants.txt" |
And this command uses the Select-Object cmdlet to limit the data that is returned and displayed onscreen. In this example, the Get-CsOnlineUser cmdlet retrieves information for all of your Lync Online users, and then the Select-Object cmdlet is used to limit the displayed data to the user’s Identity value and their archiving policy:
Copy Code | |
---|---|
Get-CsOnlineUser | Select-Object Identity, ArchivingPolicy |
Because there will be hundreds of cmdlets available for use on your computer, you might have difficulty determining which cmdlets are Lync Online cmdlets and which ones are not. To return a list of the Lync Online cmdlets (and only Lync Online cmdlets), you must first determine the name of the temporary Windows PowerShell module that contains all the Lync Online cmdlets. To do that, run this command from the Windows PowerShell prompt:
Copy Code | |
---|---|
Get-Module |
Information similar to the following will appear onscreen:
Copy Code | |
---|---|
ModuleType Name ExportedCommands ---------- ---- ---------------- Manifest Microsoft.PowerS... {Add-Computer, Add-Content, A...} Script tmp_5astd3uh.m5v {Disable-CsMeetingRoom, Enabl...} |
The module with the ModuleType Script is the module that contains the Lync Online cmdlets. To return a list of those cmdlets, run the Get-Command cmdlet, using the name of the Script module as the module name:
Copy Code | |
---|---|
Get-Command -Module tmp_5astd3uh.m5v |
It’s possible that you could have multiple modules with a ModuleType equal to Script. In that case, you can run the following command to find out which module includes the Get-CsTenant cmdlet:
Copy Code | |
---|---|
Get-Command Get-CsTenant |
The module returned for the Get-CsTenant cmdlet will be the module containing all the Lync Online cmdlets:
Copy Code | |
---|---|
CommandType Name ModuleName ----------- ---- ---------- Function Get-CsTenant tmp_5astd3uh.m5v |