Solved

Need help with modifying my PC Audit Report VB Script

Posted on 2006-10-25
6
421 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 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