I am trying to figure out the syntax to run a DSquery against a 2000 member server's local users and groups. basically I am trying to use the "dsquery user -disabled" command and it will only return items from the domain. when I enter the CN and DN info, it comes up with some errors that are syntax related. I think it could work, I just can't find a good example of the syntax for running it.
Thanks,
Well, 'DS' stands for Directory Services (I.e. 'Active Directory') and
on a local machine you don't have one - you have a SAM which is a
registry hive. The ds* tools access AD via LDAP calls and a non-DC
machine doesn't service such calls. So it won't work
Anyway, this should do the job - save it to a .vbs file and run with
cscript (for example, 'cscript DisabledLocalUsers.vbs >> Users.txt'):
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set colAccounts = GetObject("WinNT://" & strComputer & "")
colAccounts.Filter = Array("user")
For Each objUser In colAccounts
if objUser.AccountDisabled then
Wscript.Echo objUser.Name
end if
Next
HTH
--
Cheers,
Marin Marinov
MCT, MCSE 2003/2000/NT4.0,
MCSE:Security 2003/2000, MCP+I
-
This posting is provided "AS IS" with no warranties, and confers no
rights.