Retrieving All Computer in the Domain with OS Details

Asked By 7060 points N/A Posted on -
qa-featured

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

SHARE
Best Answer by Sharath Reddy
Best Answer
Best Answer
Answered By 553085 points N/A #79189

Retrieving All Computer in the Domain with OS Details

qa-featured

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 operating System operating SystemServicePack -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

Answered By 0 points N/A #79190

Retrieving All Computer in the Domain with OS Details

qa-featured

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);
}
 

Login/Register to Answer

Related Questions