Powershell以获取禁用用户的列表

Powershell以获取禁用用户的列表,powershell,active-directory,Powershell,Active Directory,我正在运行此命令以获取所有禁用用户的列表,但它不起作用 Get-ADUser -Filter (enabled -ne $true) 以下是错误消息: The term 'enabled' 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 inc luded, verify

我正在运行此命令以获取所有禁用用户的列表,但它不起作用

Get-ADUser -Filter (enabled -ne $true)
以下是错误消息:

The term 'enabled' 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 inc
luded, verify that the path is correct and try again.
At line:1 char:28
+ Get-ADUser -Filter (enabled <<<<  -ne $true)
    + CategoryInfo          : ObjectNotFound: (enabled:String) [], CommandNotF
   oundException
    + FullyQualifiedErrorId : CommandNotFoundException
术语“enabled”不能识别为cmdlet、函数、脚本的名称
文件或可操作程序。检查名称的拼写或路径是否正确
否则,请验证路径是否正确,然后重试。
第1行字符:28

+Get ADUser-Filter(enabled您需要使用脚本块来定义筛选器。parantises用于“组”,以确保在运行cmdlet之前调用其中的表达式,这在这里是错误的,因为
enabled
对powershell本身没有任何意义

Get-ADUser -Filter { enabled -ne $true }

Search-ADAccount
cmdlet有一个参数:

Search-ADAccount -AccountDisabled