3

The Get-DistributionGroup command is supposed to list distribution groups in a domain but I can't get it to run on my server.

After some Googling I found that Import-Module ActiveDirectory needs to be run first, but what I get when I run that is:

Import-Module : The specified module 'ActiveDirectory' was not loaded because no valid module file was found in any module directory.

My questions are

  1. How do I install this module into my PowerShell module directory? I thought it was supposed to do this automatically
  2. Once I have it installed, do I just run Import-Module ActiveDirectory and then I can run Get-DistributionGroup to list my dist groups?
Moshe Katz
  • 15,992
  • 7
  • 69
  • 116
Tensigh
  • 1,030
  • 5
  • 22
  • 44
  • 2
    Installing the AD tools won't help. Get-DistributionGroup is an Exchange cmdlet. You'll need to install the Exchange Management Tools, or connect to a management session on an Exchange server. – mjolinor Feb 29 '16 at 03:01
  • @mjolinor, that's exactly what I needed to know. I figured something was up. Thanks for the tip, I'll see if I can install that. – Tensigh Feb 29 '16 at 03:22

2 Answers2

1

Echoing mjolinor's comment, but feel free to append with extra info.

Installing the AD tools won't help. Get-DistributionGroup is an Exchange cmdlet.

You'll need to either:

  • install the Exchange Management Tools
  • or connect to a management session on an Exchange server
KyleMit
  • 30,350
  • 66
  • 462
  • 664
0

To connect to exchange, I would follow these steps listed in the Microsoft Docs:

  • Installing the management tools, essentially download and mount the
    iso, then run the Setup.exe. Steps are listed HERE
  • You can connect to Exchange Online by using Azure SAMI account,
    assigning the appropriate permissions (Exchange Administrator,
    Exchange Recipient Administrator) to the registered app. You can
    follow the steps using the Microsoft Docs HERE
Daikyu
  • 153
  • 9