Import ActiveDirectory PowerShell module on Windows Server

2015/11/05

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

Install PowerShell Active Directory module on Windows Server 2012

2015/09/10

Here’s the PowerShell one-liner to install Active Directory module for PowerShell on Windows Server 2012, if it’s not already installed:

Add-WindowsFeature RSAT-AD-PowerShell

After that, if you want to find out the users using the PC, you can use:

Get-ADUser -Filter * -SearchBase “ou=testou,dc=iammred,dc=net”

Note 1: Credits go to StackOverflow, IT blogs and alike, sites that helped me with the code when searching for solutions.
Note 2: Be aware that when copy-pasting, the quotes and possibly other characters get messed up by WordPress, you’ll have to replace them.


%d bloggers like this: