Asked By
anonymous
7060 points
N/A
Posted on - 04/15/2011
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
Retrieving All Computer in the Domain with OS Details
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
Retrieving All Computer in the Domain with OS Details
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);
}
Â