Need help with modifying my PC Audit Report VB Script

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.

LVL 6
thegordoAsked:
Who is Participating?
 
GrahamSkanConnect With a Mentor RetiredCommented:
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
 
GrahamSkanRetiredCommented:
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
 
thegordoAuthor Commented:
I have now uploaded the file - please search for the question number 22036851 as a reference.

Many thanks for the prompt response...

G.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
GrahamSkanRetiredCommented:
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
 
thegordoAuthor Commented:
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
 
thegordoAuthor Commented:
That is brilliant! Many thanks!

G.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.