I'm trying to run a dsquery/dsget that will result in users that weren't active for a month and that are not disabled:

dsquery user -inactive 4 -limit 0 | dsget user -samid -disabled >>desktop\users.txt

This results in an error:

dsget failed:'-' is an unknown parameter.



No, your command is correct and "-" in the name is not a problem. Have you maybe used copy&past? Because Wordpress (for example) is really eager to mess with dashes.

The better way to get the desired result is to use PowerShell:

Search-ADAccount -AccountInactive -TimeSpan (New-TimeSpan -Days 30) | Where-Object { $_.Enabled -eq $true }

Your Answer

