Solved

Need help with modifying my PC Audit Report VB Script

Posted on 2006-10-25
6
422 Views
Last Modified: 2008-01-09
Hello experts,

I desperately need help with one of the scripts I use to report on recently built PCs...
The script uses WMI to interrogate the local PC and then outputs to an Excel spreadsheet.
This works OK only in the section relating to hard drive capacity etc it scans each disk for capacity, size etc etc.

The way it outputs to Excel is shown below:

HostName OS  SP Product ID Processor CPU Speed Socket Type Bus Speed MotherBoard Manufacture MB Product Device ID File System Disk Size Free Space Used Space Video Memory Physical Memory Virtual Memory
PC1 XP SP2 55274-640-1420133-23508 IntelP4 1794 Hz Microprocessor 133 Dell Latitude C640 C: NTFS 7.8Gb       0.7Gb 7.2Gb 32.0 Mb 511.4 Mb 1,756.4Mb
PC1 XP SP2 55274-640-1420133-23508 IntelP4 1794 Hz Microprocessor 133 Dell Latitude C640 D: NTFS 29.4Gb 7.0 Gb 22.4 Gb 32.0Mb 511.4Mb 1,756.4Mb
PC1 XP SP2 55274-640-1420133-23508 IntelP4 1794 Hz Microprocessor 133 Dell Latitude C640 E: NTFS 189.9Gb 38.8 Gb 151.1 Gb 32.0Mb 511.4Mb 1,756.4Mb

Some of the data (such as hostname, processor, cpu etc etc is replicated 3 times as there are 3 drives on the pc to be audited...

What would be great is if the main data (HostName OS  SP Product ID Processor CPU Speed Socket Type Bus Speed MotherBoard Manufacture MB Product / Video Memory Physical Memory Virtual Memory) was only output once and the drive data (Device ID File System Disk Size Free Space Used Space) for each drive output below the main data...

If anyone can help me with this problem I can send the whole script to you on request...

Many thanks

G.

0
Comment
Question by:thegordo
  • 3
  • 3
6 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 17802301
You can upload files to this associated site:
www.ee-stuff.com
You use the same credentials as here.
You need to identify the question with the URL or ID.

Tell us back here if you do it. There is no automatic notification.
0
 
LVL 6

Author Comment

by:thegordo
ID: 17802861
I have now uploaded the file - please search for the question number 22036851 as a reference.

Many thanks for the prompt response...

G.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 17810479
Strewth.
That's more of a project than a question. There are 162 variables declared outside procedures and possibly more local ones.
I think that it would be optimistic to say that there is at least a weeks' worth of work there. That's what I would charge for, anyway. It might actually be less if you do it yourself because a lot of the time would be spent just getting to understand the code and the objectives.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 6

Author Comment

by:thegordo
ID: 17810555
But the script does already work...

The only part which would need to be looked at is the part which outputs each partition or external hard drive data to a new line - rather than just outputting the hdd data it outputs the main system data which has already been output as well...

These are the lines in question surely...

Set DiskSet = oWMI.ExecQuery("select DeviceID, FileSystem, Size, FreeSpace " & "from Win32_LogicalDisk where DriveType = '3'")

ReDim strDisk(RowNum,4)
for Each Disk in DiskSet                                                   'Enable For audit of each PC's disks/partitions
      strDisk(RowNum,DEV_ID)= Disk.DeviceID
      strDisk(RowNum,FSYS)= Disk.FileSystem
      strDisk(RowNum,DSIZE)= FormatNumber(Disk.Size/2^30,1) & " Gb"
      strDisk(RowNum,FSPACE)= FormatNumber(Disk.FreeSpace/2^30,1) & " Gb"
      strDisk(RowNum,USPACE)= FormatNumber((Disk.Size-Disk.FreeSpace)/2^30,1) & " Gb"

Call AddLineToXLS(strHostName, strOS, strSP, strProdID, strProc, strSpeed, strSD, strFSB, strManufact, strMBProduct, strDisk(RowNum,DEV_ID), strDisk(RowNum,FSYS), strDisk(RowNum,DSIZE), strDisk(RowNum,FSPACE), strDisk(RowNum,USPACE), strVideo, strRAM, strVir, strPage, strUser, strNIC, strMask, strGate, strNameApp1, strNameApp2, strNameApp3, strNameApp4, strNameApp5)    
 
      Next                  'Enable For audit of each PC's disks/partitions
      

Thanks

G.
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 17811118
That is a bit clearer.
Is this what you mean? I can't test it (only one disc).

    ReDim strDisk(RowNum, 4)
    i = 0
    For Each Disk In DiskSet    'Enable For audit of each PC's disks/partitions
        i = i + 1
        strDisk(RowNum, DEV_ID) = Disk.DeviceID
        strDisk(RowNum, FSYS) = Disk.FileSystem
        strDisk(RowNum, DSIZE) = FormatNumber(Disk.Size / 2 ^ 30, 1) & " Gb"
        strDisk(RowNum, FSPACE) = FormatNumber(Disk.FreeSpace / 2 ^ 30, 1) & " Gb"
        strDisk(RowNum, USPACE) = FormatNumber((Disk.Size - Disk.FreeSpace) / 2 ^ 30, 1) & " Gb"
        If i = 1 Then
            Call AddLineToXLS(strHostName, strOS, strSP, strProdID, strProc, strSpeed, strSD, strFSB, strManufact, strMBProduct, strDisk(RowNum, DEV_ID), strDisk(RowNum, FSYS), strDisk(RowNum, DSIZE), strDisk(RowNum, FSPACE), strDisk(RowNum, USPACE), strVideo, strRAM, strVir, strPage, strUser, strNIC, strMask, strGate, strNameApp1, strNameApp2, strNameApp3, strNameApp4, strNameApp5)
        Else
            Call AddLineToXLS("", "", "", "", "", "", "", "", "", "", strDisk(RowNum, DEV_ID), strDisk(RowNum, FSYS), strDisk(RowNum, DSIZE), strDisk(RowNum, FSPACE), strDisk(RowNum, USPACE), "", "", "", "", "", "", "", "", "", "", "", "", "")
        End If
    Next                        'Enable For audit of each PC's disks/partitions
0
 
LVL 6

Author Comment

by:thegordo
ID: 17842364
That is brilliant! Many thanks!

G.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question