Importing PowerShell Modules and Locating Added Cmdlets

Want to add a feature to a Windows Server 2008 R2 machine using PowerShell? That functionality is part of the ServerManager PowerShell Module that’s install by default on 2008 R2. The module has to be imported for it’s cmdlets to be made available since it’s not loaded by default when you launch PowerShell.

To view the Modules that are available to be imported, run Get-Module -ListAvailable

The ServerManager module has to be imported so that it’s commands are made available to PowerShell. This is done by running Import-Module ServerManager as shown below.

Use Get-Module with no parameters to display all of the modules that have been imported into PowerShell. If more than the ServerManager module were imported, they would be listed in the image below. Modules you import are only imported for the duration that the shell is open. The next time you open PowerShell, you’ll have to re-import the ServerManager module if you want to use it’s cmdlets again. Creating a PowerShell Profile can allow you to automatically import commonly used modules when you launch PowerShell but that’s a topic for another blog article.

To find out what commands the ServerManager Module added, run Get-Command -Module ServerManager as shown in the screenshot below:

Want to remotely administer Active Directory from a Windows 7 machine using PowerShell? You’ll need to download the Remote Server Administration Tools from the Microsoft Download Center, install it, and then enable the “Active Directory Module for Windows PowerShell” feature on the Windows 7 computer.

Then you’ll be able to import the ActiveDirectory module:

Determine what cmdlets were added by the ActiveDirectory module:

Some vendors such as EqualLogic provide PowerShell modules to manage their products with. Install the PowerShell modules provided by the vendor:

Sometimes these vendor modules aren’t installed in the locations that PowerShell looks for Modules in so it’s unaware that they’re available for import and they won’t show up in the results of Get-Module -ListAvailable. Look at the properties of the shortcut that the product created to determine what needs to be imported.

Use the path and filename to the EqlPsTools.dll to load this module:

Use the same process to determining what new cmdlets were added by this module:

I’ll cover PowerShell Snap-ins in my next blog article.

µ

1 Comment

  1. dineshvishe

    Hi,
    Get-Module -ListAvailable after it not showing
    Servermanager.
    I had tried Import-Module ServerManager but nothing happen.

    Please tell what to do ?

    Reply

Leave a Reply

%d bloggers like this: