I'm part of a small firm that is growing rapidly. I'm
looking to write a script that will inventory all of the
computers on our Windows 2000 network. The information
that I would like to capture would be the name and IP of
each machine on the network, the count of the machines on
the network, the number of processors for a giving machine,
and the number of monitors attatched to each machine. I
know how to get this information for a single, specified
computer, but I don't know how to iterate through all of
the computers on the network. I'd also like it to
atomatically discover any new systems that are put on the
network, as well as any changes to the name, IP, etc.

Thanks in advance,
Draft

Re: Inventory Script by thedaniellewis

thedaniellewis
Thu Oct 23 13:17:45 CDT 2003

"Draft" <anonymous@discussions.microsoft.com> wrote in message news:<042901c398dd$a4d431b0$a301280a@phx.gbl>...
> I'm part of a small firm that is growing rapidly. I'm
> looking to write a script that will inventory all of the
> computers on our Windows 2000 network. The information
> that I would like to capture would be the name and IP of
> each machine on the network, the count of the machines on
> the network, the number of processors for a giving machine,
> and the number of monitors attatched to each machine. I
> know how to get this information for a single, specified
> computer, but I don't know how to iterate through all of
> the computers on the network. I'd also like it to
> atomatically discover any new systems that are put on the
> network, as well as any changes to the name, IP, etc.
>
> Thanks in advance,
> Draft

I am guessing you are using WMI to get this info, probably from
Scriptomatic.
The script below can pull the names of your computers from the domain
and then all you have to do is plug that into your inventory. Of
course remember to make changes for any differences in continers if
you need to.

Hope this helps. Let me know how it goes.

Thanks.
Dan

--Begin Code--
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"

Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection

objCommand.CommandText = _
"<LDAP://dc=yourdomain,dc=com>;(objectClass=computer)" & _
";name;subtree"
Set objRecordSet = objCommand.Execute

While Not objRecordSet.EOF
strName = objRecordSet.Fields("Name")
MsgBox strName
Wend

objConnection.Close
Wscript.quit
--End Code--

Re: Inventory Script by anonymous

anonymous
Thu Oct 23 14:42:49 CDT 2003

Thanks for the reply.

I tried this snippet of code, substituting my domain for
"yourdomain", but I get an error:

Provider: Table does not exist.

What am I doing wrong?

Thanks again,
Draft




>I am guessing you are using WMI to get this info, probably
from
>Scriptomatic.
>The script below can pull the names of your computers from
the domain
>and then all you have to do is plug that into your
inventory. Of
>course remember to make changes for any differences in
continers if
>you need to.
>
>Hope this helps. Let me know how it goes.
>
>Thanks.
>Dan
>
>--Begin Code--
>Set objConnection = CreateObject("ADODB.Connection")
>objConnection.Open "Provider=ADsDSOObject;"
>
>Set objCommand = CreateObject("ADODB.Command")
>objCommand.ActiveConnection = objConnection
>
>objCommand.CommandText = _
>
"<LDAP://dc=yourdomain,dc=com>;(objectClass=computer)" & _
> ";name;subtree"
>Set objRecordSet = objCommand.Execute
>
>While Not objRecordSet.EOF
> strName = objRecordSet.Fields("Name")
> MsgBox strName
>Wend
>
>objConnection.Close
>Wscript.quit
>--End Code--
>.
>