Microsoft.Windows.Server.2008.Monitoring managment pack RRS feed

  • Question

  • In the managment pack is a Monitor logical disk fragmentation Level which runs a script to determine whether things are healthy or not. The script name is Microsoft.Windows.Server.LogicalDisk.DefragAnalysis.vbs.

    i'm getting an error when the script runs on a couple servers

    The process started at 3:00:00 AM failed to create
    System.PropertyBagData, no errors detected in the output. The process exited
    with 0

    Here I believe is the relevent part of the script causing the error:

     Set oWmiDiskSet = WMIGetInstance("winmgmts:\\" & TargetComputer & "\root\cimv2", "Win32_Volume WHERE (DriveType=3 or DriveType=6) and FileSystem!=null")

     Dim bBagIsEmpty
     bBagIsEmpty = True

     For Each oWmiDisk in oWmiDiskSet
         Dim sDriveLetter
         sDriveLetter = oWmiDisk.DriveLetter
         If IsNull(sDriveLetter) Then
             sDriveLetter = oWmiDisk.Name
             sDriveLetter = Left(sDriveLetter, Len(sDriveLetter) - 1)
         End If
         If (Not IsNull(sDriveLetter)) And (Not IsEmpty(sDriveLetter)) Then
             Dim ret, OSRecommended, dfa
             TraceLogMessage("Running DefragAnalysis (disk: " & sDriveLetter & "; computer: " & TargetComputer & ").")
             Dim e
             Set e = New Error
             On Error Resume Next
             ret = oWmiDisk.DefragAnalysis(OSRecommended, dfa)
             On Error Goto 0
             TraceLogMessage("DefragAnalysis results (return code: " & CStr(ret) & ")(disk: " & sDriveLetter & "; computer: " & TargetComputer & "): OSRecommended = " & OSRecommended & "; FilePercentFragmentation = " & dfa.FilePercentFragmentation & ".")
             If (ret = 0) And (e.Number = 0) Then
                 Set oBag = oAPI.CreatePropertyBag()
                 oBag.AddValue "DiskLabel", sDriveLetter
                 oBag.AddValue "OSRecommended", OSRecommended
                 oBag.AddValue "FilePercentFragmentation", dfa.FilePercentFragmentation
                 oAPI.AddItem oBag
                  If bBagIsEmpty Then bBagIsEmpty = False
              End If
         End If

    After some testing on these particular servers when the defrag analysis is ran it comes back as null for all the values. All the bag values come back with valid data except "FilePercentFragmentation", which comes from that defrag analysis. I believe this is causing the error/alert. The problem is I cant seem to figure out how to fix te underlying issue which is getting that defraganalysis to come back with valid data. Any ideas on what how to get that working properly?

    Thursday, April 10, 2014 7:02 PM

All replies

  • Hi,

    Thank you for your question.


    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.


    Thank you for your understanding and support.

    Regards, Yan Li

    Tuesday, April 15, 2014 2:54 AM
  • Hi Yan, thank you for taking my question into consideration. I look forward to your response. :)

    If there is any other info that you need that will assist in troubleshooting let me know and i'd be happy to provide it.

    Thursday, April 17, 2014 2:47 PM
  • Hi,

    I am trying to involve someone familiar with this topic to help. It may take some time. Thanks for your patience.

    Best Regards,

    Vincent Wu

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Monday, April 21, 2014 8:22 AM
  • Hi Goot1981, I took a look at the MP and it runs on a weekly basis configured by a "days of the week mask", and usually that is 64 (saturday). Can you configure it to run on demand (i.e. daily) and see if the issue still persists? also, how did you run the testing that you mentioned?

    at this point, I would review this from the MP "Days Of Week mask: The day(s) that the fragmentation check should be run. The values for the days are Sunday (1), Monday (2), Tuesday (4), Wednesday (8), Thursday (16), Friday (32) and Saturday (64). To specify multiple days, add the values for the days together. For example, for Monday, Wednesday, and Friday, specify 42 (2+8+32)." and then create the override for the disk(s) to run more frequently and then see what's the difference between running the script at different days.



    Tuesday, April 22, 2014 12:46 PM
  • To test I pulled the Microsoft.Windows.Server.LogicalDisk.DefragAnalysis.vbs out of the managment pack and ran it on one of the servers that was alerting with issues running the script. If I remember right I got an error, probably something about invalid data trying to be put into the property bag. After that I broke it down further and tried to recreate the data that is being put into the bags. For ease of testing I switched to powershell and wrote my own little script for this wmi query, "Win32_Volume WHERE (DriveType=3 or DriveType=6) and FileSystem!=null"

    (gwmi win32_volume -computer servername | WHERE { (($_.DriveType -eq 3 -or $_.DriveType -eq 6) -and $_.FileSystem -ne $null) } | select -first 1).name

    This is DiskLabel and is returning data properly

    (gwmi win32_volume -computer servername | WHERE { (($_.DriveType -eq 3 -or $_.DriveType -eq 6) -and $_.FileSystem -ne $null) } | select -first 1).defraganalysis().DefragRecommended

    This is OSReccommended and comes back False which is fine

    (gwmi win32_volume -computer servername | WHERE { (($_.DriveType -eq 3 -or $_.DriveType -eq 6) -and $_.FileSystem -ne $null) } | select -first 1).defraganalysis().defraganalysis

    This is the DFA variable which comes back all empty. On other servers not alerting it comes back with info. the FilePercentFragmentation is a property of defraganalysis().defraganalysis

    The issue is not so much the MP or even SCOM related I guess but more the ability of the server to return a defraganalysis.

    Wednesday, April 23, 2014 5:02 PM
  • Also, just found out a little more info. On the affected servers, if i click on "Defragment your hard drive" in the screenshot below, nothing happens. no error, no nothing.

    Wednesday, April 23, 2014 8:07 PM