No of visitors who read this post: 758
Type: Question
Author: Anonymous
Your rating: None Average: 5 (4 votes)

Hi,

Help with a easy way to retrieve all computers in the Domain With Operating system details. I would need a way query which can be used to retrieve information of all machines with OS and SP if possible.

Thanks in Advance

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

# (Solution Accepted)

Use this query in the command prompt.

All in single row. You can see it creates a text file with the machine name, Operating system & Service pack

DSQuery * domainroot -filter "(&(objectCategory=Computer)(objectClass=User))" -attr Name operatingSystem operatingSystemServicePack -limit 0 >C:\OS_SP.txt

There are much easier ways than this but as you wanted a query here you go.

Hope this helps

Regards
Sharath Reddy

# (Solution Accepted)

Run this js through cmd using the following command: chost //nologo enum_domain_computers.js

the js file should look like the following:

var strBase = "<LDAP://" + myDomain + ">;(&(objectclass=computer)(objectcategory
=computer));";
var strOptions = "cn,operatingSystem,operatingSystemVersion,Operati ngSystemServi
cePack,dNSHostName;"
var strEnd = "subtree";

var objConn = new ActiveXObject("ADODB.Connection");

objConn.Provider = "ADsDSOObject";
objConn.Open("Active Directory Provider");

var objRS = objConn.Execute(strBase + strOptions + strEnd);

objRS.MoveFirst;

for (; !objRS.EOF; objRS.MoveNext)
{
WScript.Echo("------------------------------------------------------");
WScript.Echo("Machine Name: " + objRS.Fields(0).Value);
WScript.Echo("Operating System Name: " + objRS.Fields(1).Value);
WScript.Echo("Operating System Version: " + objRS.Fields(2).Value);
WScript.Echo("Service Pack Version: " + objRS.Fields(3).Value);
WScript.Echo("Machine DNS name: " + objRS.Fields(4).Value);
}