我已使用以下查询列出Windows 2008服务器中的用户,但失败并得到以下错误.
$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)}
Run Code Online (Sandbox Code Playgroud)
例外如下:任何人都可以帮我解决这个问题吗?
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
Run Code Online (Sandbox Code Playgroud)
CB.*_*CB. 112
如果ActiveDirectory模块存在则添加
import-module activedirectory
Run Code Online (Sandbox Code Playgroud)
在你的代码之前.
要检查是否存在,请尝试:
get-module -listavailable
Run Code Online (Sandbox Code Playgroud)
ActiveDirectory模块默认存在于Windows Server 2008 R2中,以这种方式安装:
Import-Module ServerManager
Add-WindowsFeature RSAT-AD-PowerShell
Run Code Online (Sandbox Code Playgroud)
要使其工作,您需要在域中至少有一个DC作为Windows 2008 R2并在其上安装Active Directory Web服务(ADWS).
对于Windows Server 2008,请在此处阅读如何安装它
Dan*_*n B 38
如果不存在,请在此处查看如何添加activedirectory模块.这可以在任何计算机上完成,然后它将允许您访问您的活动目录"域控制"服务器.
为了防止过时链接出现问题(我发现MSDN博客过去没有任何理由消失),实质上对于Windows 7,您需要下载并安装远程服务器管理工具(KB958830).安装后,请执行以下步骤:
Windows服务器版本应该已经确定,但如果不是,则需要下载并安装Active Directory管理网关服务.如果这些链接中的任何一个应该停止工作,您仍应该能够搜索知识库文章或下载名称并找到它们.
小智 6
get-windowsfeature | where name -like RSAT-AD-PowerShell | Install-WindowsFeature
Run Code Online (Sandbox Code Playgroud)
小智 5
如果没有看到Active Directory,那是因为您没有安装AD LS用户和计算机功能。转到管理-添加角色和功能。在“添加角色和功能向导”中的“功能”选项卡上,选择“远程服务器管理工具”,然后选择“角色管理工具”-选择“ AD DS和DF LDS工具”。
之后,您可以看到PS Active Directory程序包。
| 归档时间: |
|
| 查看次数: |
346281 次 |
| 最近记录: |