Advertisement

04.16.2008 at 10:57AM PDT, ID: 23328174
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Struggling with script output format In excel

Asked by Aladdin78 in VB Script, Hard Drives & Storage, Microsoft Excel Spreadsheet Software

Tags: , , , ,

Hi Guys I have a little script that I got help with here, to get info on the free space left on my servers hard drives for monitoring purposes.  THe problem is I need alot of hand holding because this is my first foray into scripting.  My desired oucome in ecel would be:

             C:                       D:                                  E
      Free space left       Freespace left          Freespace left
Servername1                  
                  
Servername2                  
      
my current code is attached (I ahve also attached the actual spreadsheet to show you how I was doing it manualy and if possible would like to append to the existing spreadsheet or at least have it in the same style if I have to start from scratch.

            
Sub GetFreeSpace()
   
Dim iSpc, strComputer, objWMIService
Dim fso, fsHandle, MyShell, LogFileName, colItems, objItem
Dim rngCell As Range, lngCol As Long, rngOut As Range
For Each rngCell In Intersect(ActiveSheet.UsedRange, ActiveSheet.Columns("A"))
   If rngCell.Value <> "" Then
      strComputer = rngCell.Value
      Set objWMIService = GetObject("winmgmts:" _
     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
     Set colItems = objWMIService.ExecQuery _
      ("Select * From Win32_LogicalDisk Where DriveType = 3")
      lngCol = 1
      For Each objItem In colItems
         'Retrieve free space & convert from uint64
         iSpc = CDbl(objItem.FreeSpace)
         iSpc = iSpc / 1024
         Set rngOut = Cells(rngCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1)
         rngOut.Value = objItem.Caption
         rngOut.Offset(0, 1).Value = Format(iSpc, "#,##0 ""KB""")
         lngCol = lngCol + 1
      Next objItem
   End If
Next rngCell
End Sub

The problem with this is that it puts the drive,kb in the next cell to the right.  I want it to come out like in the example above.  I have tried messing about with the

"Set rngOut = Cells(rngCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1)"
and

rngOut.Value = objItem.Caption
         rngOut.Offset(0, 1).Value = Format(iSpc, "#,##0 ""KB""")
         lngCol = lngCol + 1
but cant get it right due to my utter nubness

I will not be awarding only 500 points but also my sisters hand in marriageStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
Sub GetFreeSpace()
   
Dim iSpc, strComputer, objWMIService
Dim fso, fsHandle, MyShell, LogFileName, colItems, objItem
Dim rngCell As Range, lngCol As Long, rngOut As Range
For Each rngCell In Intersect(ActiveSheet.UsedRange, ActiveSheet.Columns("A"))
   If rngCell.Value <> "" Then
      strComputer = rngCell.Value
      Set objWMIService = GetObject("winmgmts:" _
     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
     Set colItems = objWMIService.ExecQuery _
      ("Select * From Win32_LogicalDisk Where DriveType = 3")
      lngCol = 1
      For Each objItem In colItems
         'Retrieve free space & convert from uint64
         iSpc = CDbl(objItem.FreeSpace)
         iSpc = iSpc / 1024
         Set rngOut = Cells(rngCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1)
         rngOut.Value = objItem.Caption
         rngOut.Offset(0, 1).Value = Format(iSpc, "#,##0 ""KB""")
         lngCol = lngCol + 1
      Next objItem
   End If
Next rngCell
End Sub
Attachments:
 
Free Drive space spreadsheet
 
 
Loading Advertisement...
 
[+][-]04.16.2008 at 11:20AM PDT, ID: 21370555

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 11:43AM PDT, ID: 21370736

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 11:53AM PDT, ID: 21370841

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 12:01PM PDT, ID: 21370916

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 12:02PM PDT, ID: 21370925

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 12:29PM PDT, ID: 21371164

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 12:42PM PDT, ID: 21371264

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 01:32PM PDT, ID: 21371704

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 02:33PM PDT, ID: 21372192

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 04:14PM PDT, ID: 21372815

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 04:33PM PDT, ID: 21372921

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.17.2008 at 02:08AM PDT, ID: 21375334

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.17.2008 at 02:22AM PDT, ID: 21375388

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.17.2008 at 03:22AM PDT, ID: 21375630

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: VB Script, Hard Drives & Storage, Microsoft Excel Spreadsheet Software
Tags: Microsoft, Excel, VB script, WMI output to excel, VB
Sign Up Now!
Solution Provided By: bigjokey
Participating Experts: 3
Solution Grade: A
 
 
[+][-]04.17.2008 at 05:48AM PDT, ID: 21376366

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.17.2008 at 05:54AM PDT, ID: 21376428

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.17.2008 at 06:06AM PDT, ID: 21376538

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.17.2008 at 06:09AM PDT, ID: 21376577

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.17.2008 at 04:57PM PDT, ID: 21382371

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.17.2008 at 06:03PM PDT, ID: 21382601

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.18.2008 at 03:04AM PDT, ID: 21384445

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.18.2008 at 03:07AM PDT, ID: 21384457

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.18.2008 at 03:33AM PDT, ID: 21384566

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628