Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 429
  • Last Modified:

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.

0
thegordo
Asked:
thegordo
  • 3
  • 3
1 Solution
 
GrahamSkanCommented:
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
 
GrahamSkanCommented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

G.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now