PowerShell: Import-Module Active Directory Cmdlet

PowerShell: Import-Module Active Directory Cmdlet

For those looking to query or do something within Active Directory in a PowerShell script, one of the most common mishaps I see at work is people forgetting to import the model. Often times everything else is fine, no syntax errors, etc. A simple fix for that is:

import-module activedirectory

The error generally looks something like this:

PS C:\Users\userone> New-ADComputer -Name test
The term 'New-ADComputer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:15
+ New-ADComputer <<<<  -Name test
    + CategoryInfo          : ObjectNotFound: (New-ADComputer:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\userone>

One thought on “PowerShell: Import-Module Active Directory Cmdlet

  1. The 5.0 Beta 2 Sequencer UI produces an MSI. I beievle that only when Sequencing via command-line, that the /MSI parameter is required to produce an MSI.It is possible (maybe probable) that when the App-V 5 team worked with the Office 2013 team, they Sequenced in command-line and did not actually produce an MSI to accompany the AppV file.The MSI produced by saving the AppV in the 5.0 beta 2 Sequencer does not work for installation. It fails with a 1603 error.Yes, I can still mount and make available the Sequenced Office 2013 with the PowerShell commands, but I would like to deploy it like I normally do.SCCM 2012 SP1 will interface and deploy AppV files like they were MSIs. Maybe non-SCCM deployment suites will follow suit. But I would really like to have the MSI produced (if one was) when Office 2013 was Sequenced.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.