Cant use dsquery
Ok I'm at a loss. I know there are othe ways to do this but the fact that I cant is urking me. 2008 R2 domain, running from W7 machine.
I ran some dsquery | dsget commands and got what I was looking for initially. Now it does not work at all.
dsquery user -disabled "ou=users,dc=domain,dc=com" -limit 5000 | dsget user -samid > C:\users.txt
Had tried the -limit 0 and that gave an error. So I changed it to 5000 since my results were a little over 4000.
Exporting list of all disabled users but only their samid
Well now when I run it I get:
The process cannot access the file becasue it is being used by another process. dsget failed:'-disabled' is an unknown parameter.
There are no prrocesses running, the file it was writing to no longer exists. If I do a dsget /? I get the help menu.
However if I do a dsquery /? I get the exact same error message. It wont even give me the help menu...Already restarted and nothing. I log in and just type dsquery /? and i get the same message:(copied from dos window)
C:\Users\test\Desktop>dsquery user -disabled "ou=users,dc=domain,dc=com" -limit 5000 | dsget user -samid 1>C:\users.txt
The process cannot access the file because it is being used by another process.
dsget failed:'-disabled' is an unknown parameter.
type dsget /? for help.C:\Users\dch4616.MHGHPF\Desktop>
Its like the entire sting above is stuck somewhere and even if I just try the command for help i still get it. Anyone know what I can do?
August 1st, 2012 7:17pm
Hi,
I believe you are trying to get the SAMName matches with your filter. You can use the below command for 2008 R2 domain,
C:\Users\Test\Destop>dsquery user -disabled -d domain -limit 5000 -samid user >c:\users.txt
Domain you can replace with domain name and user you can replace with user name. If you want for all users, you can remove user.
Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2012 7:31pm
Well I cant do that. If I enter in dsquery anything including dsquery /? for help it simply repeats my last command that failed. It's like something is stuck. Even if I go to another computer and logon and do a dsquery /? it does the same thing.
I thought maybe a process was hung, so I restarted. Thats when I tried another computer. I checked the domain controllers, but don't see anything out of the ordinary. I would chalk it up to something weird on my machine but why's it doing it on another.
August 2nd, 2012 8:34pm
Hi Carito,
Thank you for the post.
So the issue is resolved after you rebooted the server?
RegardsRick Tan
TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
August 3rd, 2012 4:47am
Well haven't restarted the domain controllers yet. Im scheduled to today for WUs unless something comes up that prevents it. I'll post back if that clears it up.
August 3rd, 2012 8:05am


