Share via


Error on first attempt to use PowerShell

Question

Monday, July 12, 2010 9:44 PM

We've just added a 2008R2 server to our environment.  I ran the BPA and followed it suggestion to run this command:

 

<i>Get-ADOrganizationalUnit –filter {name –like “*”} -Properties ProtectedFromAccidentalDeletion | where {$_.ProtectedFromAccidentalDeletion –eq $false} | Set-ADOrganizationalUnit -ProtectedFromAccidentalDeletion $true</i>

 

(from http://technet.microsoft.com/en-us/library/dd723677(WS.10).aspx).  The error says:

 

<i>The term 'Get-ADOrganizationalUnit' is not recognized as the name of a cmdlet, function, script file, or oper
am. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
</i>

Is there something I have to load? What am I missing here? Thanks.

 

All replies (4)

Monday, July 12, 2010 10:02 PM ✅Answered | 1 vote

It looks like it's one of the AD cmdlets.

Run this first and try again:

import-module activedirectory

Alexei


Tuesday, July 13, 2010 5:52 AM

Hi,

I agree with Alexei, you may have to run " import-module activedirectory".

For more information about PowerShell for Active Directory, please refer to the following article:

Active Directory Administration with Windows PowerShell
http://technet.microsoft.com/en-us/library/dd378937(WS.10).aspx

Thanks.

 

This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.


Tuesday, July 13, 2010 9:55 PM

Looks good, thanks. As I begin using this, are there other modules I should expect to need to import?


Tuesday, July 13, 2010 11:11 PM | 1 vote

Looks good, thanks. As I begin using this, are there other modules I should expect to need to import?

You can see what Modules you have available (BitsTransfer, PSDiagnostics): Get-Module -ListAvailable

To see available snap-ins (Quest): Get-PSSnapin -Registered