Excel report for memory, CPU and disk utilization report

Satish Auti
Satish Auti used Ask the Experts™
on
Hello,

I have an script which gives me output of memory, CPU and disk utilization in excel. Whenever I run the script it gives output in different new file.
I want report should get generated in single file for multiple run times. So that I can take average utilization report for all these items.

Is there any way to modify the script to append this data in single file?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
#AKS#Tech Bloggggerrr

Commented:
Could you please share the script you use, it will be easy to understand and propose the solution.

Thanks
Satish AutiSenior System Administrator

Author

Commented:
File attached.
Checklist1.vbs
strDirectory="D:\Checklist\Output"
.
.
.
hr=Hour(Now)
mi=Minute(Now)
se=Second(Now)
dn=Right(Now,2)
time=hr & mi & se & dn
sys=Day(Date) & MonthName(Month(Date)) & time
mth=strDirectory & "\Checklist(" & sys & ").xls"
Set objFSO=CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(mth) Then

Open in new window

so mth = "D:\Checklist\Output\Checklist(" + sys + ").xls"
sys appears to be a date TIME based, so will be unique every time it is used

Also i think you will find a benefit of using a YYYYMMDD format for a file name - they automatically sort into chronological order that way
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Satish AutiSenior System Administrator

Author

Commented:
Ok .. it is clear that code is already written there to edit the existing excel but its not happening.

Set objFSO=CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(mth) Then
      Set objExcel=CreateObject("Excel.Application")
      Set objWorkbook=objExcel.WorkBooks.Open(mth)
      Set objWorkbook=objExcel.ActiveWorkBook.WorkSheets("Sheet1")
      i=objExcel.Cells(250,250).Value
      count=objExcel.Cells(250,251).Value
Else
      Set objExcel=WScript.CreateObject("Excel.Application")
      Set objWorkbook=objExcel.Workbooks.Add()
      Set objWorkSheet=objWorkbook.Worksheets(1)
      i=2
      count=1

How do I set a name for excel file in script as it's automatically taking name depend upon a what time it runs like below. See the pic.
Capture.JPG
Thats what i said!

If you remove the time element from the filename
sys=Day(Date) & MonthName(Month(Date)) & time

Open in new window

   goes to  
sys=Day(Date) & MonthName(Month(Date))

Open in new window

then you will get one file for every day

But my suggestion is that Convert this to end up with "Checklist-YYMMDD" so that the files sort by default into chronological order

so something like
"sys=Year(Date) & Month(Date) & Day(Date)"

Open in new window

or do away with the intermediate step
"mth=strDirectory & "\Checklist-" & Year(Date) & Month(Date) & Day(Date) & ".xls"

Open in new window

Simple mod to script

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial