我使用以下查询列出了Windows2008服务器中的用户,但失败了,并得到以下错误。
$server='client-pc-1';$pwd= convertto-securestring 'password$' -asplaintext -
force;$cred=new-object -typename System.Management.Automation.PSCredential -argumentlist 'Administrator',$pwd; invoke-command -computername $server -credential
$cred -scriptblock {Get-ADUser -Filter (enabled -ne $true)}
这个例外是给below...Can的,有人能帮我解决这个问题吗?
The term 'Get-ADUser' 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.
+ CategoryInfo : ObjectNotFound: (Get-ADUser:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
发布于 2013-07-09 20:50:25
如果存在ActiveDirectory模块,请添加
import-module activedirectory
在你的代码之前。
要检查是否存在,请尝试:
get-module -listavailable
windows server 2008 R2中默认存在ActiveDirectory模块,请按如下方式安装:
Import-Module ServerManager
Add-WindowsFeature RSAT-AD-PowerShell
为了使其正常工作,您需要域中至少有一个域控制器作为windows 2008 R2,并且在其上安装了Active Directory Web服务(ADWS)。
对于Windows Server 2008,请阅读here how to install it
发布于 2017-07-10 20:25:45
get-windowsfeature | where name -like RSAT-AD-PowerShell | Install-WindowsFeature
发布于 2014-08-20 01:01:06
如果你看不到Active Directory,那是因为你没有安装AD LS用户和计算机功能。转到Manage - Add Roles &Feature。在添加角色和功能向导的功能选项卡上,选择远程服务器管理工具,然后选择-角色管理工具-选择AD DS和DF LDS工具。
之后,您可以看到PS Active Directory包。
https://stackoverflow.com/questions/17548523
复制相似问题