1

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.

How

1

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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.