 
奇怪了,之前在另外一台server上面还是可以用的,刚开始怀疑是不是PowerShell版本太低了,索性查一下:
PS C:\Users\admin> $PSVersionTable
Name                           Value                                                                                                                                                         
----                           -----                                                                                                                                                         
PSVersion                      5.1.14393.2515                                                                                                                                                
PSEdition                      Desktop                                                                                                                                                       
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                       
BuildVersion                   10.0.14393.2515                                                                                                                                               
CLRVersion                     4.0.30319.42000                                                                                                                                               
WSManStackVersion              3.0                                                                                                                                                           
PSRemotingProtocolVersion      2.3                                                                                                                                                           
SerializationVersion           1.1.0.1   版本都5.1了,不是很老啊!OK,那再来看看有没有AD模块吧,毕竟这个命令是对AD的操作。运行: get-module -listavailable 回车,走你,结果一看。原来如此,目测没有AD模块。

那就导入一下吧,运行:
PS C:\Windows\system32> Add-WindowsFeature RSAT-AD-PowerShell
然后再运行一把get-module,看一下,ActiveDirectory加载过来了
PS C:\Windows\system32> get-module -listavailable
最后运行一下命令:PS C:\Windows\system32> Get-ADOrganizationalUnit,不再报错,而且提示需要参数,着就对了。
我在另外一个server上面也试了另外一种方法:
首先运行:get-module -listavailable 查看ActiveDirectory模块是否已经加载。
然后就是直接运行:import-module activedirectory
如果没有报错,就再运行:get-module -listavailable 
这个时候ActiveDirectory模块就被导入了,关于AD相关的PowerShell命令你就可以开始用了。
The term ‘Get-ADOrganizationalUnit‘ 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:5 char:38
+ $SVSOUList = Get-ADOrganizationalUnit <<<<  -SearchBase $sourceOU -Filter {Name -like "W2K8_*"} |select -ExpandProperty Name
    + CategoryInfo          : ObjectNotFound: (Get-ADOrganizationalUnit:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\Users\admin> import-module activedirectory
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\Users\admin> get-module -listavailable
ModuleType Name                      ExportedCommands                                                           
---------- ----                      ----------------                                                           
Manifest   ActiveDirectory           {}                                                                         
Manifest   ADRMS                     {}                                                                         
Manifest   AppLocker                 {}                                                                         
Manifest   BestPractices             {}                                                                         
Manifest   BitsTransfer              {}                                                                         
Manifest   GroupPolicy               {}                                                                         
Manifest   PSDiagnostics             {}                                                                         
Manifest   ServerManager             {}                                                                         
Manifest   TroubleshootingPack       {}                                                                         
Manifest   Citrix.XenDesktop.Admin   {}                                                                         
Manifest   Citrix.Common.Commands    {}                                                                         
Binary     TelemetryModule           {}                                                                         
原文:http://blog.51cto.com/jiaszwx/2317941