Import ActiveDirectory PowerShell module on Windows Server

To check if Active Directory module is installed, use

get-module -listavailable

If the PowerShell module is not present, it can be added using Add-WindowsFeature cmdlet

  if ((get-module -name ActiveDirectory) -eq $null) {
    Import-Module ServerManager
    Add-WindowsFeature RSAT-AD-PowerShell
  }
  Import-Module ActiveDirectory

Note: Credits go to StackOverflow, IT blogs and alike, sites that helped me with the code when searching for solutions.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: