473,698 Members | 2,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with retreiving hardware information

Hello,

I'm trying to get this script working. Bascially, it gets a list of
computers from AD, then loops through them to gather hardware informatino
(which it writes to a text file). It runs fine for the first computer, echos
its name then runs the WMI component.

The problem is that after if echos the second computer name it it gets to
line 43 and dies with an error. I'm really new to VB scripting, so I was
hoping someone here could help be figure out what's wrong. Below is the
script in question. Notice that the AD computers are in an OU and not the
default computer container.


-- Begin Paste

'****** This part gets all objetcts at the given AD location (OU, Container,
etc)

Set objDictionary = CreateObject("S cripting.Dictio nary")
i = 0

Set objOU = GetObject("LDAP ://OU=DOMAINNAMECo mputers, DC=DOMAINNAME,
DC=local")
objOU.Filter = Array("Computer ")

For Each objComputer in objOU
objDictionary.A dd i,objComputer.C N
i = i + 1

Next

For Each objItem in objDictionary
strComputer = objDictionary.I tem(objItem)

Wscript.echo strComputer

'***** Open Text File for Output, named %Computername%. tsv in c:\scripts

Set objFSO = CreateObject("S cripting.FileSy stemObject")
Set objTextFile = objFSO.CreateTe xtFile("c:\scri pts\" & strComputer &
".tsv")

' Enumerates Software
Set objWMIService = GetObject("winm gmts:" _
& "{impersonation Level=impersona te}!\\" & strComputer & "\root\cimv 2")
Set colSoftware = objWMIService.E xecQuery _
("SELECT * FROM Win32_Product")
objTextFile.Wri teLine "Caption" & vbtab & _
"Descriptio n" & vbtab & "Identifyin g Number" & vbtab & _
"Install Date" & vbtab & "Install Location" & vbtab & _
"Install State" & vbtab & "Name" & vbtab & _
"Package Cache" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _
& "Version"
For Each objSoftware in colSoftware
objTextFile.Wri teLine objSoftware.Cap tion & vbtab & _
objSoftware.Des cription & vbtab & _
objSoftware.Ide ntifyingNumber & vbtab & _
objSoftware.Ins tallDate & vbtab & _
objSoftware.Ins tallLocation & vbtab & _
objSoftware.Ins tallState & vbtab & _
objSoftware.Nam e & vbtab & _
objSoftware.Pac kageCache & vbtab & _
objSoftware.SKU Number & vbtab & _
objSoftware.Ven dor & vbtab & _
objSoftware.Ver sion

Next

Next

objTextFile.Clo se

------
End Paste

Any help is most appreciated!

Thanks!
Nov 20 '05 #1
1 1232
Sorry wrong group.
"Isaac" <pi********@NG. com> wrote in message
news:eH******** ******@TK2MSFTN GP12.phx.gbl...
Hello,

I'm trying to get this script working. Bascially, it gets a list of
computers from AD, then loops through them to gather hardware informatino
(which it writes to a text file). It runs fine for the first computer, echos its name then runs the WMI component.

The problem is that after if echos the second computer name it it gets to
line 43 and dies with an error. I'm really new to VB scripting, so I was
hoping someone here could help be figure out what's wrong. Below is the
script in question. Notice that the AD computers are in an OU and not the
default computer container.


-- Begin Paste

'****** This part gets all objetcts at the given AD location (OU, Container, etc)

Set objDictionary = CreateObject("S cripting.Dictio nary")
i = 0

Set objOU = GetObject("LDAP ://OU=DOMAINNAMECo mputers, DC=DOMAINNAME,
DC=local")
objOU.Filter = Array("Computer ")

For Each objComputer in objOU
objDictionary.A dd i,objComputer.C N
i = i + 1

Next

For Each objItem in objDictionary
strComputer = objDictionary.I tem(objItem)

Wscript.echo strComputer

'***** Open Text File for Output, named %Computername%. tsv in c:\scripts

Set objFSO = CreateObject("S cripting.FileSy stemObject")
Set objTextFile = objFSO.CreateTe xtFile("c:\scri pts\" & strComputer &
".tsv")

' Enumerates Software
Set objWMIService = GetObject("winm gmts:" _
& "{impersonation Level=impersona te}!\\" & strComputer & "\root\cimv 2")
Set colSoftware = objWMIService.E xecQuery _
("SELECT * FROM Win32_Product")
objTextFile.Wri teLine "Caption" & vbtab & _
"Descriptio n" & vbtab & "Identifyin g Number" & vbtab & _
"Install Date" & vbtab & "Install Location" & vbtab & _
"Install State" & vbtab & "Name" & vbtab & _
"Package Cache" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _
& "Version"
For Each objSoftware in colSoftware
objTextFile.Wri teLine objSoftware.Cap tion & vbtab & _
objSoftware.Des cription & vbtab & _
objSoftware.Ide ntifyingNumber & vbtab & _
objSoftware.Ins tallDate & vbtab & _
objSoftware.Ins tallLocation & vbtab & _
objSoftware.Ins tallState & vbtab & _
objSoftware.Nam e & vbtab & _
objSoftware.Pac kageCache & vbtab & _
objSoftware.SKU Number & vbtab & _
objSoftware.Ven dor & vbtab & _
objSoftware.Ver sion

Next

Next

objTextFile.Clo se

------
End Paste

Any help is most appreciated!

Thanks!

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4702
by: berthelot samuel | last post by:
Hi everyone, I am currently trying to write a report based on a View of SQL Server. Basically, I have 3 tables : Hardware, SoftwareInstalled and Software with SoftwareInstalled that keeps track of all the software installed on each piece of hardware by referencing the primary keys of each table. So now, I have a request that retrieve information from those 3 tables giving a list of all the hardware with their details + the software...
4
6401
by: Morgan Leppink | last post by:
Hey all - We are running SQL 2000 with ALL available service packs, etc. applied. We just built a brand new database server, which has dual 2Ghz XEONs, 2GB memory, and the following disk configuration: RAID 1 array (2 disks) Operating System Windows Server 2003 RAID 1 array (2 disks) Database Logs RAID 10 array (4 disks) Database Data
2
3529
by: Ian DeRock | last post by:
I'm fairly new to XML. As I can see it, XML is a way to organize data like in a table in a RDB, or the RDB itself. I have used XML in application data, but did not design the actual XML. I have a background in both hardware and software. I want to create an application that will regenerate a resume from the XML Resume that I have. I would like some people to look over my XML Resume data and give me suggestions on the XML. This...
5
6449
by: Scott Dowd | last post by:
I need explicit example of how to use SetupDi* functions in both C# .NET and VB .NET to determine device interface detail for a given device class with interface information detail. All examples available on the web and/or Microsoft documentation are C or C++ based and do not take into account the various issues and pitfalls that the .NET based environment incurs, or otherwise avoids over unmanaged code, in short, no examples of how to...
5
2158
by: Chua Wen Ching | last post by:
Hi, I read from this tutorial at codeproject Question A: http://www.codeproject.com/csharp/GsXPathTutorial.asp regarding xpath.. but i try to apply in my situation, and can't get it work...
4
4853
by: wqyuwss | last post by:
Hi, We have several core dumps in our product. These core dump can be reproduced in the same place. That is system function call std::basic_istream<char,std::char_traits<char>>::getline. The result of pstack for the core dump is > pstack core | c++filt
110
10579
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst case scenario for MyISAM backend? Also is it possible to not to lose data but get them corrupted?
41
4429
by: x01001x | last post by:
When programming in C (not C++) how does one send information to a hardware device such as a video card or modem? How is this done in Linux C programming versus Microsoft C programming?
4
35955
Niheel
by: Niheel | last post by:
http://bytes.com/images/howtos/technologies_cut_cost_slow_economy.jpgThere's no escaping the slowing economy. Layoffs are being announced and companies are in cost cutting mode. Whether you are a tech at a big company or a small one man operation it's time to cut the fat before you get cut out of work. Unnecessary expenses have to go and inefficient ways of working need to be analyzed and improved. If done right, the use of some...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7739
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.