Chapter 7. Adding commands

One of PowerShell’s primary strengths is its extensibility. As Microsoft continues to invest in PowerShell, it develops more and more commands for products including Exchange Server, SharePoint Server, the System Center family, SQL Server, and so on. Typically, when you install these products’ management tools, you also get a graphical management console of some kind and one or more extensions for Windows PowerShell.

7.1. How one shell can do everything

We know you’re probably familiar with the graphical Microsoft Management Console (MMC), which is why we’ll use it as an example of how PowerShell works. The two work similarly when it comes to extensibility, in part because the same Management Frameworks team within Microsoft develops both the MMC and PowerShell.

When you open a new, blank MMC console, it’s largely useless. It can’t do anything, because the MMC has little built-in functionality. To make it useful, you go to its File menu and select Add/Remove Snapins. In the MMC world, a snap-in is a tool, such as Active Directory Users and Computers, DNS Management, DHCP Administration, and so on. You can add as many snap-ins to your MMC as you like, and you can save the resulting console to make it easier to reopen that same set of snap-ins in the future.

7.2. About product-specific “management shells”

7.3. Extensions: finding and adding snap-ins

7.4. Extensions: finding and adding modules

7.5. Command conflicts and removing extensions

7.6. On non-Windows operating systems

7.7. Playing with a new module

7.8. Profile scripts: preloading extensions when the shell starts

7.9. Getting modules from the internet

7.10. Common points of confusion

7.11. Lab

7.12. Lab answers