使用 Get-ADUser 在 powershell 中查找信息不起作用,无法识别术语
using Get-ADUsers to find info in powershell not working, term not recognized
我正在尝试从我的 AD 用户那里检索一些信息,在 PowerShell 上使用以下命令:
get-aduser -identity username -Properties * | select DisplayName, City, State
但是它给了我这个错误:
get-aduser : 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.
At line:1 char:1
+ get-aduser -identity username -Properties * | select DisplayName, Cit ...
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (get-aduser:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我也试过添加这个导入:
Import-Module ActiveDirectory
但我却得到了另一个错误:
Import-Module : The specified module 'ActiveDirectory' was not loaded because no valid module file was found in any module directory.
At line:1 char:1
+ Import-Module ActiveDirectory
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (ActiveDirectory:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
我做错了什么?
您需要安装 RSAT Tools 才能使用 ActiveDirectory
模块。
如果您安装了 Windows 10 October 2018 Update
或更高版本,则可以将 RSAT 工具安装为 Windows 功能:
Note: The sample below doesn't use the direct name since there is a version suffix at the end of the name.
Get-WindowsCapability -Online | Where-Object { $_.Name -like "Rsat.ActiveDirectory.DS-LDS.Tools*" } | Add-WindowsCapability -Online
否则,您可以从我之前提供的 link 安装 RSAT 工具。那里包含有关如何为 Windows.
的 still-supported 版本手动安装的说明
我正在尝试从我的 AD 用户那里检索一些信息,在 PowerShell 上使用以下命令:
get-aduser -identity username -Properties * | select DisplayName, City, State
但是它给了我这个错误:
get-aduser : 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.
At line:1 char:1
+ get-aduser -identity username -Properties * | select DisplayName, Cit ...
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (get-aduser:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我也试过添加这个导入:
Import-Module ActiveDirectory
但我却得到了另一个错误:
Import-Module : The specified module 'ActiveDirectory' was not loaded because no valid module file was found in any module directory.
At line:1 char:1
+ Import-Module ActiveDirectory
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (ActiveDirectory:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
我做错了什么?
您需要安装 RSAT Tools 才能使用 ActiveDirectory
模块。
如果您安装了 Windows 10 October 2018 Update
或更高版本,则可以将 RSAT 工具安装为 Windows 功能:
Note: The sample below doesn't use the direct name since there is a version suffix at the end of the name.
Get-WindowsCapability -Online | Where-Object { $_.Name -like "Rsat.ActiveDirectory.DS-LDS.Tools*" } | Add-WindowsCapability -Online
否则,您可以从我之前提供的 link 安装 RSAT 工具。那里包含有关如何为 Windows.
的 still-supported 版本手动安装的说明