keyongtech


  keyongtech > windows.server.* > windows.server.active_directory > 09/2006

 #1  
09-20-06, 11:04 PM
Mike Matheny
We have most of our servers hidden for security reasons. Is there any way to
enumerate all servers, including hidden ones?
 #2  
09-21-06, 09:38 AM
chriss3 [MVP]
Hello Mike.
I'm not sure what you mean with "hidden servers", You can use the following
LDAP query as long the particular security context has at least read write
to the operatingSystem attribute on all servers, that is also the default
behaivor.

dsquery * -attr operatingSystem distinguishedName -scope subtree -filter "
(|(operatingSystem=*Server*))"
 #3  
09-21-06, 01:37 PM
Mike Matheny
At a command prompt enter:
net config server /hidden:yes

BTW, the command you suggested returned nothing, not even an error.
 #4  
09-21-06, 10:03 PM
ESP
You have to remember NET CONFIG SERVER /Hidden
only hides the server from Network Neighborhood, but not in AD, etc... and
from the Browser Lists that happens normally on a Windows network.

This cmd line can also have adverse effects on the Server Service itself.
For ex. if you add/remove RAM to those servers, the Server service no longer
auto-tunes itself to the changes.

Although I don't have one handly, look into using a vbs script to enermurate
all servers in AD ;-)

ESP

===================================




"Mike Matheny" wrote:
[..]
 #5  
09-21-06, 10:12 PM
ESP
Here ya go, just wrote one for ya that searches for all 2k and 2k3 servers
and exports those to a txt file.
(watch word wrap)

'---begin
Const ADS_SCOPE_SUBTREE = 2
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile1 = objFSO.OpenTextFile("Total Machine Count.txt",8,True)
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = "SELECT Name, operatingSystem,
operatingSystemVersion " _
& "FROM 'LDAP://dc=global,dc=avaya,dc=com' " _
& "WHERE objectCategory='computer'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
If (objRecordSet.Fields("operatingSystem").Value = "Windows Server 2003")
Or _
(objRecordSet.Fields("operatingSystem").Value = "Windows 2000 Server") Then
objFile1.WriteLine objRecordSet.Fields("Name").Value & vbTAB & _
objRecordSet.Fields("operatingSystem").Value
Else
End If
objRecordSet.MoveNext
Loop
objFile1.Close
WScript.Echo "Enumerate All Servers in AD that are Win2000 or Win2003 has
FINISHED..."
'---end

ESP

===================================

"ESP" wrote:
[..]
 #6  
09-22-06, 09:29 PM
Mike Matheny
Thanx a bunch - however, I'm getting a table does not exist error on line
13:

1 Const ADS_SCOPE_SUBTREE = 2
2 Set WshShell = WScript.CreateObject("WScript.Shell")
3 Set objFSO = CreateObject("Scripting.FileSystemObject")
4 Set objFile1 = objFSO.OpenTextFile("Total Machine Count.txt",8,True)
5 Set objConnection = CreateObject("ADODB.Connection")
6 Set objCommand = CreateObject("ADODB.Command")
7 objConnection.Provider = "ADsDSOObject"
8 objConnection.Open "Active Directory Provider"
9 Set objCommand.ActiveConnection = objConnection
10 objCommand.Properties("Page Size") = 1000
11 objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
12 objCommand.CommandText = "SELECT Name, operatingSystem,
operatingSystemVersion " & "FROM 'LDAP://dc=global,dc=avaya,dc=com' " &
"WHERE objectCategory='computer'"
13 Set objRecordSet = objCommand.Execute
14 objRecordSet.MoveFirst
15 Do Until objRecordSet.EOF
16 If (objRecordSet.Fields("operatingSystem").Value = "Windows Server 2003")
Or (objRecordSet.Fields("operatingSystem").Value = "Windows 2000 Server")
Then
17 objFile1.WriteLine objRecordSet.Fields("Name").Value & vbTAB &
objRecordSet.Fields("operatingSystem").Value
18 Else
19 End If
20 objRecordSet.MoveNext
21 Loop
22 objFile1.Close
23 WScript.Echo "Enumerate All Servers in AD that are Win2000 or Win2003 has
FINISHED..."
 #7  
09-22-06, 09:38 PM
ESP
Make sure to change over the LDAP line (12 I think) to point to your AD
environment ;-)

Also, watch for word-wrap....
ESP

==========================

"Mike Matheny" wrote:
[..]
 #8  
09-22-06, 09:59 PM
Mike Matheny
DOH!!!! Been a long week - ESP, thanx a bunch. I really need to get a book
on scripting!
 #9  
09-22-06, 10:14 PM
ESP
np, glad I could help.
Well, no book needed for now ;-)
http://www.microsoft.com/technet/scr....mspx?mfr=true

ESP

===================

"Mike Matheny" wrote:
[..]
Similar Threads
Utility to check domain servers time, all servers in the domain

Hello all, The end of daylight savings time has made me aware an utility is needed to monitor all servers in a domain and provide a display. from there the time rollover...

2k3 domain w/ DNS servers as virtual ones, phys servers startup is

I decided to virtualize my two DC/DNS/DCHP servers.. but (i guess naturally) this has caused a problem.. I split these two over two different physical hosts to prvent this...

Swithing from office servers to alternative backup servers - email / domain setup question

Hi there, We are setting up two Windows Servers as dummy servers as part of a disaster recovery solution (Waiting ready and setup in case of disaster in the office). These...

Enumerate Servers

I would like to build a list of servers from our current domain and feed into scripts. How do I enumerate servers from the domain? Thanks

Enumerate SQL servers?

I'm working on an Access app that will have a SQL 2K backend. My setup will install MSDE, and I will set the sa password, etc. which I don't want the end user's to know. My...


All times are GMT. The time now is 03:16 AM. | Privacy Policy