1

A while back I wrote a simple .ps1 that let me look up the name of a user or the hostname of a computer and tell me which OU of my AD it resided in. I don't recall having any difficulty running the Get-ADComputer command on the computer that I originally wrote the script on, but that computer has since had to be reformatted and even though I've installed the Remote Server Administration Tools on the new workstation I can't get PS to recognize any cmdlets from the AD module. I definitely have Active Directory Module for Windows PowerShell enabled in control panel > Programs and Features > Turn Windows Features on or off because if I go into Start > Administrative Tools Active Directory Module for Windows PowerShell shows up as one of the options.

If I open this module, I can run AD commands just fine so it IS working, it's just not working in my normal PowerShell window.

Any insight would be appreciated.

1 Answer 1

3

You'll need to import the module so that it loads the cmdlets. Try adding import-module ActiveDirectory to the top of your script. You don't have to do this when you run the module from admin tools because it does this for you.

1
  • Thanks! That was what I was missing. Funny how half an hour of Google couldn't have shown me such a simple fix. Commented Feb 6, 2015 at 18:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .