Determine if <computername> is domain member

  • Thread starter Thread starter Matt Hickman
  • Start date Start date
M

Matt Hickman

I have a generated list of computernames and I want to determine, from
the command line, if those individual computers are members of the
domain or not. Is there a way to do this?

"netdom query /domain:<domainname> workstation" will give me a list of
workstations, but that gives me more than I want and takes an enormous
amount of time to complete.

Any ideas?

Thanks,
 
I have a generated list of computernames and I want to determine, from
the command line, if those individual computers are members of the
domain or not. Is there a way to do this?

"netdom query /domain:<domainname> workstation" will give me a list of
workstations, but that gives me more than I want and takes an enormous
amount of time to complete.

netdom also seems incredibly slow. Have you tried:
dsquery computer -name workstation
It will return the distinguished name if workstation exists, and nothing
if it doesn't.

To get a list of computer accounts, much faster than netdom:
dsquery computer
and to display only the account (computer) name:
dsquery computer -o rdn
or
dsquery computer -o samid

Details at
<http://technet2.microsoft.com/Windo...43fd-4985-b429-cd53d3046f011033.mspx?mfr=true>.
 
I have a generated list of computernames and I want to determine, from
the command line, if those individual computers are members of the
domain or not. Is there a way to do this?

"netdom query /domain:<domainname> workstation" will give me a list of
workstations, but that gives me more than I want and takes an enormous
amount of time to complete.

Any ideas?

Thanks,

In addition to dsquery, you can use ADFIND.EXE from tip 5898 » Freeware ADFind.
in the 'Tips & Tricks' at http://www.jsifaq.com

In the following isdom.bat file, "c:\zipnew\zcomp.txt" contains a list of computer names.

The output might look like:
"JSI009","Y"
"JSI007","Y"
"JSI003","N"
"JSI001","Y"


@echo off
setlocal ENABLEDELAYEDEXPANSION
for /f "Tokens=*" %%a in ('type "c:\zipnew\zcomp.txt"') do (
set DOM=N
for /f "Tokens=*" %%c in ('adfind -default -dsq -f "&(objectcategory=computer)(Name=%%a)"') do (
set DOM=Y
)
@echo "%%a","!DOM!"
)
endlocal

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 
Back
Top