Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

winmgmts access to inventory network PC 1

Status
Not open for further replies.

bbitzer

Programmer
Feb 4, 2003
8
0
0
US
I would like to capture Processor information on each PC in the local network into a database for reference. This is part of a script to output information in the cmd window (for now it is fine) but only for the local machine that the script is run. Is there a way to access the network PC's winmgmts. Is there a way to pass administrator login information?
we use UNC, (\\My_Computer) does that make a difference?

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
For Each objItem in colItems
Wscript.Echo "AddressWidth: " & objItem.AddressWidth

ETC.........
Next
 
Hello

This is how I do it.
A list of servernames in 'Serverlist.txt' and then go.
Impersonate will get you truogh with the credentials your logged on to your local machine with.
So log on with domain admin rights and run...

Script starts here:

Set objFSO = CreateObject("Scripting.FileSystemObject")

ServerListe = "ServerList.txt"
Set objFileSrvList = objFSO.OpenTextFile(ServerListe,1)
strComputer=objFileSrvList.ReadLine
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top